|
Question : Missing semicolon (;) at end of SQL statement
|
|
I am getting a run-time error '3137 (Missing semicolon (;) at end of SQL statement error) with the following code:
DoCmd.RunSQL "INSERT INTO tbl_Addresses (CategoryID3) VALUES ('1') WHERE addressID = " & lstBox1
I have tried the following combinations, but none seem to work:
DoCmd.RunSQL "INSERT INTO tbl_Addresses (CategoryID3) VALUES ('1') WHERE (addressID = '" & lstBox1 & "')"
and
DoCmd.RunSQL "INSERT INTO tbl_Addresses (CategoryID3) VALUES ('1') WHERE (addressID = '" & lstBox1 & "');"
lstBox1 is bound to a number field when clicked.
|
|
Answer : Missing semicolon (;) at end of SQL statement
|
|
Is addressID a text field? If not then your first try should be right - you shouldn't need the ' ' around lstBox1.
Do you check the value of lstBox1 to make sure it has a value before trying.
And the semicolon at the end of an SQL statement should be optional (almost all of the time!)
Is CategoryID3 numeric?
|
|
|