SQL Error Help

  • Thread starter Thread starter RayToddJr
  • Start date Start date
R

RayToddJr

The following is the SQL that I have in my code:

strSQL = "INSERT INTO taDEFENDANTS(TrusteeDefendantID)" & _
"VALUES(lngTrusteeDefendantID)" & _
"WHERE DefendantID=" & lngDefendantID & ";"

I keep getting the following error:

Run-time error 3137:
Missing semicolon (;) at end of SQL statement.

What am I not including so that the code 'sees' the semicolon.

Thanks,

Ray.
 
When you use an INSERT statement, you would not have a WHERE clause (except
in a subquery). If you are trying to change the value of a record that is
already in the table (e.g. the record where DefendantID = lngDefendantID),
then this should be an UPDATE query. Also, you are missing several spaces in
the SQL statement. You should start each line after the first with a space
(e.g. " WHERE...) .
 
Back
Top