SQL Update stmt with variable

  • Thread starter Thread starter Jeremy
  • Start date Start date
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
 
Back
Top