I'm always having problems with SQL queries and WHERE statements. I know it's the syntax which is wrong. If you can tell me what's wrong with the query I would be very grateful. I know I can shorten the control to me!<blah> but I tried using a query to do what I wanted and used the full syntax from that but it didn't work out too well.
Basically I'm trying to subtract one from the InStock field in the Inventory field where the barcode in the inventory table = the txtBarCode1 text field on the form.
This code is executed from a command button.
Also if you have any usful guides or FAQs about SQL statements that you could point me at that would be great.
Thanks in advance :)
Set dbTransaction = DBEngine.Workspaces(0).Databases(0)
Set rsInventory = dbTransaction.OpenRecordset("SELECT InStock FROM tblInventory WHERE (((tblInventory.BarCode)=[Forms]![frmOrderItems]![txtBarCode1]));")
!InStock = !InStock - 1
Set rsInventory = Nothing
Set dbTransaction = Nothing