update all records

  • Thread starter Thread starter Mark Kubicki
  • Start date Start date
M

Mark Kubicki

this ought to be easy...

i want to update(?) 1 field in all of the records of a table that meet a
criteria

ex:
table = Notes, with fields ID, and print
for each record in table [Notes] where [ID] = variable, print = "true"

thanks in advance,
mark
 
Mark said:
this ought to be easy...

i want to update(?) 1 field in all of the records of a table that
meet a criteria

ex:
table = Notes, with fields ID, and print
for each record in table [Notes] where [ID] = variable, print =
"true"

Dim sql as String
sql = "UPDATE Notes " & _
"SET print = 'true' " & _
"WHERE ID = " & variable

CurrentDB.Execute sql, dbFailOnError

The above assumes ID is a numeric field and that print is a text field. If
print is a Yes/No field then use...

Dim sql as String
sql = "UPDATE Notes " & _
"SET print = -1 " & _
"WHERE ID = " & variable

CurrentDB.Execute sql, dbFailOnError
 
"Mark Kubicki" wrote in message
this ought to be easy...

i want to update(?) 1 field in all of the records of a table that meet a
criteria

ex:
table = Notes, with fields ID, and print
for each record in table [Notes] where [ID] = variable, print = "true"


Is this something you want to do in code? If so, you could use something
like this:

CurrentDb.Execute _
"UPDATE Notes SET Print = True WHERE ID = " & YourIDVariable, _
dbFailOnError

That's assuming (a) that your ID field is numeric, not text, and (b) that
Print is a yes/no field and you want to set it to the boolean value True,
not the text value "true". If I'm wrong in those assumptions, adjustments
have to be made.
 
Back
Top