SQL Error Help

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.
 
D

Daryl S

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...) .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top