vb code help

androomc

Registered User.
Local time
Today, 10:31
Joined
Jun 27, 2003
Messages
23
hi. can you guys please help me with a problem?

i have a form with a print button on it. this print button will print a report for me. once it has printed this report, i would like to go through every record in my 'REMINDERS' table and change all records with reminder_PRINTED = false to reminder_PRINTED = true.

what VB code do i need to add to this button's onclick command to get it to do this?
 
The best way to do this is with an Update Query. Try the following code.

Dim mySQL as string
Dim qry as dao.querydef

mySQL = "UPDATE Reminders SET reminder_PRINTED = true
WHERE reminder_PRINTED = false;"
set qry = CurrentDB.createQuerydef(vbnullstring, mySQL)
qry.Execute

This approach is slower than creating a named query and executing it. To do this, create query using the above SQL and name it for example qry_Reminders_UpdateReminderPrinted_Upd

set qry = CurrentDB.querydefs("qry_Reminders_UpdateReminderPrinted_Upd")
qry.Execute.

Good Luck! IF you have any questions, please let me know.



You could also create a
 

Users who are viewing this thread

Back
Top Bottom