On Sun, 3 Jul 2005 18:10:07 +0100, John wrote:
Hi
I have this code as below that first runs a report and then an update query
to set a flag so these records are not included in the report next time.
Private Sub Command2_Click()
DoCmd.OpenReport "MyReport", acViewPreview
DoCmd.OpenQuery "MyQuery"
End Sub
The problem is that as the report comes up the code execution continues and
the query is also run to set the flags. The result is that the report is
unable to show all the records as flags of some records are already set by
the query while report is being loaded. How can I "halt" the execution at
report stage and only allow the query to run when user has closed the
report?
Thanks
Regards
Only open the report from the Command button event.
Place the OpenQuery code in the Report's Close event (or the Report
Footer Format event).
Note: You are running the report in preview. Is that what you want?
The query will update the records after preview. If you then decide to
Print the report, they will appear to have already been printed.
If you wish to update the table records only after the report has been
printed (not previewed), search
http://www.groups.google.com
for my reply to the thread started by Stephanie with the subject of
'Knowing what you've printed' dated 6/23/2005 in
microsoft.public.access.reports.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.