Hi, I have a set of records I'm trying to run an update on, here's the code I'm using.
Code:
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
DoCmd.RunSQL "UPDATE Inventory SET BarsGivenExtra=" & Forms!CreateOrders!CreateOrdersVansSetForTransfer.Form!BarsLeft & _
" WHERE OrderID = " & Forms!CreateOrders!OrdersOrdersSubform.Form!OrderID & " And Product = " & Forms!CreateOrders!CreateOrdersVansSetForTransfer.Form!ProductID
When that code runs only the record with focus gets updated, so I need to manual select each record, press the button and select another record until done, how can I make it so all the records update?
If I remove the productID from the WHERE clause it updates all the records for the order but it updates them all with the first record from the source.
I tried adding the SELECT and FROM to the code but it always brings up a runtime error saying syntax error in statement.
Code:
DoCmd.RunSQL "UPDATE Inventory SET BarsGivenExtra=" & _
"SELECT ProductID, " & [Forms]![CreateOrders]![OrdersOrdersSubform]![OrderID] & " AS OrderID, " & "BarsLeft " & _
"FROM InventoryLevelVansSetForTransfer " & _
"WHERE OrderID = " & Forms!CreateOrders!OrdersOrdersSubform.Form!OrderID & " And Product = " & Forms!CreateOrders!CreateOrdersVansSetForTransfer.Form!ProductID
Any help would be great.