N
njl
I have some VB code behind a form which generates a simple SQL
statement but it does not execute - I get "Syntax Error in Insert
Into" error message.
VB Code is :
strSQL = "DELETE * FROM tblYear"
cnnCLUB.BeginTrans
cnnCLUB.Execute (strSQL)
strSQL = "INSERT INTO tblYear ( ID, StartofYear, Open, Closed ) "
& _
"VALUES( " & txtYear & ", '01/01/" & txtYear & "', Yes, No)"
cnnCLUB.Execute (strSQL)
cnnCLUB.CommitTrans
cnnCLUB is an open ADO Connection to an Access database
The first SQL command (DELETE ... ) executes ok but the INSERT does
not. The contents of strSQL when the INSERT command is executed are :
INSERT INTO tblYear ( ID, StartofYear, Open, Closed ) VALUES( 2003,
'01/01/2003', Yes, No)
If I go into the immediate window & print strSQL, create a new query
with this code & execute it works ok, implying syntax is fine.
Any ideas ??
statement but it does not execute - I get "Syntax Error in Insert
Into" error message.
VB Code is :
strSQL = "DELETE * FROM tblYear"
cnnCLUB.BeginTrans
cnnCLUB.Execute (strSQL)
strSQL = "INSERT INTO tblYear ( ID, StartofYear, Open, Closed ) "
& _
"VALUES( " & txtYear & ", '01/01/" & txtYear & "', Yes, No)"
cnnCLUB.Execute (strSQL)
cnnCLUB.CommitTrans
cnnCLUB is an open ADO Connection to an Access database
The first SQL command (DELETE ... ) executes ok but the INSERT does
not. The contents of strSQL when the INSERT command is executed are :
INSERT INTO tblYear ( ID, StartofYear, Open, Closed ) VALUES( 2003,
'01/01/2003', Yes, No)
If I go into the immediate window & print strSQL, create a new query
with this code & execute it works ok, implying syntax is fine.
Any ideas ??