invalid sql statement,expected "delete","insert","procedure","select" or "update"
it a run time error which i recieve when an saving a record to the database. and this is the code.
rsord.Open "order", cnnord, adOpenKeyset, adLockPessimistic
cnnord.Execute "INSERT INTO order(OrderId,DateOrdered,CustomerId,QuatityOrdered,ProductTitle,PurchasedUnitPrice);" _
& "VALUES('" & txtoid.Text & "','" & txtod.Text & "','" & txtcid.Text & "',' " & txtqo.Text & "',' " & txtPt.Text & "',' " & txtpup.Text & "');"


the bolded statement is highlitened yellow when the error occurs
thanks dani

use anyone of the followings :-

if rsord.state=adstateopen then rsord.close
rsord.open "select * from order",cnnord,1,2
rsord.addnew
rsord!orderid=txtoid.Text
rsord!DateOrdered=txtod.Text
rsord!CustomerId=txtcid.Text
rsord!QuatityOrdered=txtqo.Text
rsord!ProductTitle=txtPt.Text
rsord!PurchasedUnitPrice=txtpup.Text
rsord.update
if rsord.state=adstateopen then rsord.close
set rsord=nothing

OR

INSERT ORDER (OrderId,DateOrdered,CustomerId,QuatityOrdered,ProductTitle,PurchasedUnitPrice) VALUES(txtoid.Text,FORMAT(txtod.Text,"dd-MMM-yyyy"),txtcid.Text,VAL(txtqo.Text),txtPt.Text,
VAL(txtpup.Text))

hope this helps.

regards
Shouvik

This article has been dead for over six months. Start a new discussion instead.