SQL Update stmt with variable

J

Jeremy

The following code will not execute the "n" variable
correctly...any ideas? The Test.id is a number - long
integer. This works if I remove "n" and just type in a
number.

Dim updateSQL As String
Dim n As Integer
n = 1

updateSQL = "UPDATE Test SET Test.Name = ""NewName"" WHERE
_
Test.id = " & n & ";"

Do Until n = 4
cnCurrent.Execute (updateSQL)
MsgBox "done loop " & n
n = n + 1
Loop
End Sub

Thanks,
Jeremy
 

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