Thanks Joe. Good advice. I've tried adding code to produce the exception caught in a message box but I'm apparently not inputting that correctly. How would you go about doing this?
Instead of doing it like this:
Code:
CurrentDb.Execute "INSERT INTO companytable (ticker, company, sector, subindustry, lastupdate, flag) " & _
" VALUES('" & Me.cboTicker & "', '" & Me.txtCompany & "', '" & Me.txtSector & "', '" & Me.txtSubIndustry & "', #" & _
Me.dtLastupdate & "#, " & me.cbxFlag & ")"
try it like this:
Code:
Dim mySQL as String
' Build SQL Code to run and store as string
mySQL = "INSERT INTO companytable (ticker, company, sector, subindustry, lastupdate, flag) " & _
" VALUES('" & Me.cboTicker & "', '" & Me.txtCompany & "', '" & Me.txtSector & "', '" & Me.txtSubIndustry & "', #" & _
Me.dtLastupdate & "#, " & me.cbxFlag & ")"
' View SQL code before running to make sure it matches your sample SQL code gained from running query manually
MsgBox mySQL
' Execute SQL code (only after sure everything is correct)
CurrentDb.Execute mySQL
I sometimes use:
instead of:
Code:
CurrentDb.Execute mySQL