I have a table (tblInventory) with a quantity field (Qty). I am trying to subtract the quantity that the user enters on the transaction form (frmXaction) as removing from inventory, from the quantity in the inventory table. When that is done, I want the transaction form to close, then the Inventory detailed form (frmInventoryDetail) to close, and then requery the inventory (frmInventory) to show the new quantity in the inventory. I copied the code from another post & put in my names. I must have missed something, because now I get a runtime error 3144: Syntax error in update statement. It looks just like the code as far as I can see. Does anyone else see a problem with this code doing what I want it to do?
Private Sub CmdConfirm_Click()
Dim var As Long
var = DLookup("Qty", "tblInventory", "[Indx] = " & Me.txIndx) - Me.Qty
CurrentDb.Execute "UPDATE table SET " & _
"tblInventory.Qty = " & var & " WHERE " & _
"[Indx] = " & Me.txIndx
DoCmd.Close
DoCmd.Close
DoCmd.Requery
End Sub