By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

How to "hold" execution

P: n/a
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
Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
DoCmd.OpenReport "MyReport", acViewPreview, , , acDialog

The 5th parameter of the OpenReport is the WindowMode. acDialog halts
execution in the current form until the report is closed (among other
things).

Nov 13 '05 #2

P: n/a
ab****@centurytel.net wrote:
DoCmd.OpenReport "MyReport", acViewPreview, , , acDialog

The 5th parameter of the OpenReport is the WindowMode. acDialog halts
execution in the current form until the report is closed (among other
things).


Only in A2002 or A2003 though right?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #3

P: n/a
Something of a kludge maybe:
wrap the opening of the report in a modal form. That is, you need a very
simple form, (probably just an OK button of 1x1 cm) with in its Open
event the docmd.openreport statement. Drawback is, however, that this
form then is, well, modal. You cannot view the whole report at once
because that form is in the way.

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


--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
For human replies, replace the queue with a tea

Nov 13 '05 #4

P: n/a
Not in A97, at least! openForm has that argument, openReport doesn't.

ab****@centurytel.net wrote:
DoCmd.OpenReport "MyReport", acViewPreview, , , acDialog

The 5th parameter of the OpenReport is the WindowMode. acDialog halts
execution in the current form until the report is closed (among other
things).


--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
For human replies, replace the queue with a tea

Nov 13 '05 #5

P: n/a
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.
Nov 13 '05 #6

P: n/a
"John" <Jo**@nospam.infovis.co.uk> wrote in
news:42***********************@news-text.dial.pipex.com:
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?


Run the query in the report's OnClose event.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.