Update Syntax Error

  • Thread starter Thread starter Les
  • Start date Start date
L

Les

Despite repeated attempts I cant master this Update syntax

All I want to do is update one field in its own table. Having attempted
numerous combinations I still get "Expected parameter error 1"

I have stopped the code and viewed the intItemsInList variable and it looks
ok to me. But obviously not OK!

Can someone please guide me on this thanks

Les

Dim intItemsInList As Integer
intItemsInList = numNumber_of_Order_Items

strsql = "Update tblItem_Count Set numQuantity = " & intItemsInList

CurrentDb.Execute strsql, dbFailOnError
 
Here is what I do:

Dim intItemsInList As Integer
intItemsInList = numNumber_of_Order_Items

strsql = "Update tblItem_Count Set numQuantity = " &
intItemsInList

'Print the SQL string we're trying to run.
Debug.Print strsql

CurrentDb.Execute strsql, dbFailOnError


Now, in the debug window, copy/paste the sql code into a
new query. Try running it there. You should get a
parameter box asking for value. What name is there? That
is where the problem is.

Usually, this error occurs becuase the numQuantity field
either doesn't exist, or it is spelled wrong. Pasting the
SQL code helps you find it.


Chris
 
Back
Top