Syntax error

Gavx

Registered User.
Local time
Today, 17:38
Joined
Mar 8, 2014
Messages
155
I am trying to run this statement but receive a syntax error.
The intention is to run this query collecting all records for GuestID 195 and appending the table with these same records but assigned to GuestID 196. That is the intention.

Code:
strSQL = "INSERT INTO tblGuestProduct (GuestID, ProductID, RetailPrice)" _
          & " SELECT " & newGuestID & "," _
          & " ProductID," _
          & " RetailPrice," _
          & " FROM tblGuestProduct" _
          & " WHERE GuestID = " & oldGuestID

I have done a debug to the intermediate window and pasted into a query which gives me this;
INSERT INTO tblGuestProduct (GuestID, ProductID, RetailPrice) SELECT 195, ProductID, RetailPrice, FROM tblGuestProduct WHERE GuestID = 196

but this gives me a syntax error with the "FROM' highlighted.

Note that I am am trying to copy the GuestID record 195 into a new guest record of 196 but with the same fields of 195 (same table).

Can anyone help with the syntax error please?
 
Delete the comma before FROM.
 

Users who are viewing this thread

Back
Top Bottom