I am getting a syntax error on my SQL statement.
On a form I have a sub form containing the field txtGuestID - whose control source is GuestID.
On the main form I have a button that fires the code below.
I am sure I am not referring to the control txtGuestID correctly.
Can someone please give me some direction on where I am going wrong.
thanks
On a form I have a sub form containing the field txtGuestID - whose control source is GuestID.
On the main form I have a button that fires the code below.
I am sure I am not referring to the control txtGuestID correctly.
Can someone please give me some direction on where I am going wrong.
thanks
Code:
Private Sub cmdInbound_Transport_Click()
Dim iProductID As Integer
Dim sSQL As String
On Error GoTo cmdInbound_Transport_Err
iProductID = Nz(DLookup("[DefaultProductID]", "tblProductType", "[ProductTypeID] = 1"))
sSQL=INSERT INTO tblGuestProduct(ProductID, GuestID) VALUES (iProductID,[sbfGuest].Form![txtGuestID]);
DoCmd.RunSQL (sSQL)
DoCmd.Close
End Sub