Error "expected end of statement

ritati

New member
Local time
Today, 16:10
Joined
Nov 8, 2012
Messages
3
Hi,
I'm trying to divide a command
onto multiple lines. When I try to put underscore _
my code turns red and VBA tells me I have an
error expected end of statement.
Can someone please explain how this is done.
code:
DoCmd.RunSQL "INSERT INTO tblInventoryTransactions ([TransactionType],[ProdID], [Quantity],[PurchaseOrderID] )VALUES (" & 1 & ", " & ProductId.Value & "," & Quantity.Value & " , " & PurchaseID.Value & ");"
 
Please use code tags when you post code, see my signature for details
Try this:
Code:
DoCmd.RunSQL "INSERT INTO tblInventoryTransactions ([TransactionType],[ProdID], [Quantity],[PurchaseOrderID] ) " & _ 
             " VALUES (" & 1 & ", " & ProductId.Value & "," & Quantity.Value & " , " & PurchaseID.Value & ");"
 
Thank you
Solved
 

Users who are viewing this thread

Back
Top Bottom