我正在尝试运行此代码但收到编译错误 - INSERT ....行上的语句的预期结束。
可能出现什么问题?
Private Sub cmdInbound_Transport_Click()
Dim iProduct As Integer
iProductID = DLookup("DefaultProductID", "tblProductType", "ProductTypeID" = 1)
INSERT INTO tblGuestProduct (ProductID, GuestID,) VALUES (iProductID,tblBooking!subGuest.GuestID);
End Sub
答案 0 :(得分:0)
您的Insert语句中有一个额外的逗号。试试这个,
INSERT INTO tblGuestProduct (ProductID, GuestID)
VALUES (iProductID,tblBooking!subGuest.GuestID);
答案 1 :(得分:0)
删除逗号(GuestID
附近)。插入行应该是这样的:
INSERT INTO tblGuestProduct (ProductID, GuestID) VALUES (iProductID,tblBooking!subGuest.GuestID);
完整代码:
Private Sub cmdInbound_Transport_Click()
Dim iProduct As Integer
iProductID = DLookup("DefaultProductID", "tblProductType", "ProductTypeID" = 1)
INSERT INTO tblGuestProduct (ProductID, GuestID) VALUES (iProductID,tblBooking!subGuest.GuestID);
End Sub