Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT INTO statement
Message
De
19/09/2000 22:12:56
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00417975
Message ID:
00418349
Vues:
24
>>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"
Sorry to mislead everyone. I actually cut short the SQL statement to
make it looks simple, but I have left out the 2 parenthesis.
My actual statement is as follows:

cnn1.Execute "INSERT INTO DTCList(IndexNo, NRIC, CustName, DTCDate, Birthday, PrintDate) " & _
"VALUES('" & Trim(!IndexNo) & "', '" & Trim(!NRIC) & "', '" & Trim(!CustName) & "', #" & Trim(CStr(!DTCDate)) & "# , #" & Trim(CStr(!Birthday)) & "# , #" & Trim(CStr(Date)) & "# ) " & _
"WHERE DTCList.IndexNo <> '" & Trim(!IndexNo) & "' AND DTCList.CaseClosed"

I still get the missing semicolon(;) error, pls advise, thanks a lot.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform