Update does not read content of variable

  • Thread starter Thread starter AL
  • Start date Start date
A

AL

When this update query runs the it does not recognize the value of integer
variable vno in the WHERE field. A window opens labeled vno and asks for a
value. If a value is entered the update complete and it goes to the next
loop. what is need to make the content of vno available. The s syntax of
the update string was copied from an update query with the vno replacing a
numeric constant.

While Cnt < Maxseq
Rno = Int(Rnd() * 100)
vno = Cnt
SQL1 = "UPDATE StudentTable SET StudentTable.SortFld = Int(Rnd() * 100)
WHERE ((StudentTable.SeqNO = vno))"
DoCmd.RunSQL SQL1
Cnt = Cnt + 1
Wend
 
Try concatenating the variable into the string:

"...WHERE (StudentTable.SeqNO = " & vno & ")"
 
Back
Top