Updating table in SQL

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

in a click event-I'm trying to update all records (staNum field) in a table
based on min value of a field in a query [QSta]. but i get a pop up asking
me for parameter value strSta. what am i doing wrong

strSta = Nz(DMin("StaNum", "QSta"), "ZZ")
If strSta <> "ZZ" Then 'tbl is not empty
'update tables
MsgBox "strsta= " & strSta '<-----this value is correct

strSQL = "UPDATE tlkpService " & _
"SET [tlkpService].[StaNum] = strSta;"
DoCmd.RunSQL strSQL
 
You must concatentate the value of the variable, not the name of the
variable. Try this:

strSQL = "UPDATE tlkpService " & _
"SET [tlkpService].[StaNum] = " & strSta & ";"
 
Hi,
Try this:
strSQL = "UPDATE tlkpService " & _
"SET [tlkpService].[StaNum] = '" & strSta & "'"
 
Back
Top