loop through records

T

The Iconoclast

Greetings.
Could anyone please help me on this, I have a table that contains a
true/false field. Upon extracting several "false" records by means of a
query how do I make a procedure/macro that would automatically loop through
the records and replace the "false" with "true"

Thank you
 
G

Graham R Seach

There's no need to loop through a recordset; you can use set processing to
get the job done in a fraction of the time it would take using row
processing. In other words, use an action query:

Dim sSQL As String
sSQL = "UPDATE myTable SET myField = False WHERE myField = True"
CurrentDb.Execute sSQL, dbFailOnError
'All done! :)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
D

Douglas J. Steele

All done, except for the fact that you antipodeans always get things
backwards. Must come from walking around upside down... <g, d & r>

The request was to 'replace the "false" with "true"', so you'd want

sSQL = "UPDATE myTable SET myField = True WHERE myField = False"
 
G

Graham R Seach

What's 32768 between friends?

-Thanks Doug!

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Top