I give up, Issue with Insert statement (1 Viewer)

davper

Registered User.
Local time
Yesterday, 23:20
Joined
Nov 15, 2006
Messages
18
I can't figure out what is wrong with my insert statement. I know it is going to be something simple that I am missing. I have just spent too much time trying to resolve.

Here is my code
Code:
strSQL = "Insert into tbl_ProvExpenses (CID,ETID,Option,StartDate," & _
        "POICount,Amount,ATotal,CTotal,Support,SubAccount) " & _
        "Values ( 1, " & Me.cmbAccount.Value & ", '" & Me.cmbOption.Value & _
        "', #" & Me.txtStartDate.Value & "#, " & Me.txtPeriods.Value & _
        ", " & Me.txtAmount.Value & ", " & Me.txtAnnualTotal.Value & _
        ", " & Me.txtCommitTotal.Value & ", '" & Me.cmbSupport.Value & _
        "', '" & Me.txtSub.Value & "');"
Debug.Print strSQL
DoCmd.RunSQL strSQL

This is the result of the debug.print
Code:
Insert into tbl_ProvExpenses 
(CID,ETID,Option,StartDate,POICount,Amount,ATotal,CTotal,Support,SubAccount) 
Values ( 1, 7, 'Lifetime of Commitment Per Year', #9/1/2009#, 3, 10000, 10000, 30604
, 'Section', '01-123-45-678-9');

The error I keep getting is "Syntax error in 'Insert Into' statement"

I tried double quotes instead of single quotes, verified spelling, and data types.

:confused::confused::confused:
 

RayH

Registered User.
Local time
Yesterday, 20:20
Joined
Jun 24, 2003
Messages
132
Isn't OPTION a reserved word?
Could it be that?
 

Toff

Registered User.
Local time
Yesterday, 22:20
Joined
Aug 10, 2010
Messages
40
Ray, I'm totally stealing your avatar.
 

davper

Registered User.
Local time
Yesterday, 23:20
Joined
Nov 15, 2006
Messages
18
We have a winner! [Option] it is.:D

Thanks for your help guys.

I should keep a list of the reserved words handy for just such an occasion.
 

Users who are viewing this thread

Top Bottom