Results 1 to 2 of 2
Thread: update query? (2000-SR1)
2007-03-10, 22:14 #1
- Join Date
- Jan 2005
- Wichita, Kansas, USA
- Thanked 0 Times in 0 Posts
update query? (2000-SR1)
I have a report that I print--it is based on a query "ProcessQuery" that brings up all records where the yes/no field "Processed" is "No"
As soon as this report prints, I would like the table to be updated so that all of those previously unprocessed records(and unprinted) automatically get set to "Processed" by changing the yes/no field "Processed" value to "Yes".
How does one do that?
2007-03-10, 22:57 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: update query? (2000-SR1)
Create an update query that sets Processed to Yes for all records with Processed = No.
You can run this query (using DoCmd.OpenQuery or CurrentDb.Execute) from the On Close event of the report.
Warning: Access doesn't distinguish between previewing and printing a report. You may want to ask the user for confirmation:
Private Sub Report_Close()
If MsgBox("Do you want to mark the records as Processed?", _
vbYesNo + vbQuestion) = vbYes Then
Alternatively, you can open/print the report from a command button on a form. You can also run the update query from the On Click event procedure of the command button.