Update does not read content of variable

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
 
A

Allen Browne

Try concatenating the variable into the string:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top