>I got the following error: (VB6 on Access 2000)
>
>Run-time error
>Missing semicolon (;) at end of SQL statement
>
>My SQL statement is:
>cnn1.Execute "INSERT INTO Table1(IndexNo, CustName, Birthday, " & _
>"VALUES('" & Trim(!IndexNo) & "', '" & Trim(!CustName) & "', #" & _
>Trim(CStr(!Birthday)) & "#" & _
>"WHERE Table1.IndexNo <> '" & Trim(!IndexNo) & _
>"' AND Table1.CaseClosed = False"
>
>The error occurs when I added the "WHERE....." statement. Pls advise.
You forget 2 parenthesis (before the Values and the Where keywords). The complete statement should read like:
cnn1.Execute "INSERT INTO Table1(IndexNo, CustName, Birthday) " & _
"VALUES('" & Trim(!IndexNo) & "', '" & Trim(!CustName) & "', #" & _
Trim(CStr(!Birthday)) & "#) " & _
"WHERE Table1.IndexNo <> '" & Trim(!IndexNo) & _
"' AND Table1.CaseClosed = False"
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com