Change data in a table using code.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I need some help writing code to be able to change the data in a certain
numeric field within a table, where if the value = 1, change it to 2, in
every record in the table. The table is not very large. Only about 100k
records.

Thanks for your help.
Dale
 
You're best off using an Update query to do this, even if you run it through
VBA. It's almost always significantly faster to using queries than
recordsets.


Dim strSQL As String

strSQL = "UPDATE MyTable SET MyValue = 2 WHERE MyValue = 1"
CurrentDb().Execute strSQL, dbFailOnError

Replace MyTable and MyValue with the appropriate names.
 
Back
Top