Append Query "Too few parameters. Expected 1"

KpAtch3s

Registered User.
Local time
Today, 13:01
Joined
Sep 28, 2015
Messages
14
Ok so I have a button on a forum that should append the data from this form to a table. The query works perfectly, but I'm getting an error.

Dim strSql As String

strSql = "INSERT INTO InvWorkOrderT ( ProductID, Quantity ) " & _
"SELECT WorkOrderDetailT.ProductID, WorkOrderDetailT.Quantity " & _
"FROM WorkOrderT INNER JOIN WorkOrderDetailT ON WorkOrderT.WorkOrderID = WorkOrderDetailT.WorkOrderID " & _
"WHERE (((WorkOrderT.WorkOrderID) = [Forms]![WorkOrderF]![WorkOrderID])) " & _
"GROUP BY WorkOrderDetailT.ProductID, WorkOrderDetailT.Quantity; "

CurrentDb.Execute strSql, dbFailOnError

Obviously from the title I'm getting "Too few parameters. Expected 1"

Any ideas on what I'm missing?
 
The Execute method can't interpret the form reference. You have to concatenate that value into the string. Presuming it's numeric:

"WHERE WorkOrderT.WorkOrderID = " & [Forms]![WorkOrderF]![WorkOrderID] & " " & _
 
Awesome, Thanks. Works perfectly!
 

Users who are viewing this thread

Back
Top Bottom