This error is appearing in following line of the vb code
rs.Open "select * From Reservation where [table_number]=tablenumber.text and booking_date=bookingdate.Text", cn, adOpenStatic, adLockPessimistic
It's a problem with your SQL query. The reason for the message is that the SQL parser can't identify a token in your SQL query and interprets it as a parameter for which you need to provide a value.
So, you either mistyped some of your field or table names, or you created your SQL the wrong way. I suppose the latter and it should read
rs.Open "select * From Reservation where [table_number] = " & tablenumber.text & " and booking_date=" & bookingdate.Text, cn, adOpenStatic, adLockPessimistic
because tablenumber
and bookingdate
are very likely form controls.
The above query won't work out of the box as you need to use the correct data types for the SQL query which I cannot infer based on your sparse information.
If you are INSERT
ing values in TABLE - dont miss enclosing it in single quotes, like
' " & text1.text & " '
example:
INSERT into [TABLE NAME]([Purchase Order Status]) values(' " & text1.text & " ')