Recognizing when a Print Preview window closes

B

Becky

hello gurus
I have a loop that has a statement:
DoCmd.OpenReport strDocName, acViewPreview

The report (it is called rptAreaSummary) appears as expected in its own
window. I want code to stop execution in the loop until the current report
preview window is closed. Then the loop should continue executing. How can
this be done?

thanks for any advice
Becky
 
D

Dirk Goldgar

Becky said:
hello gurus
I have a loop that has a statement:
DoCmd.OpenReport strDocName, acViewPreview

The report (it is called rptAreaSummary) appears as expected in its own
window. I want code to stop execution in the loop until the current
report
preview window is closed. Then the loop should continue executing. How
can
this be done?


What version of Access? In (at least) recent versions, the DoCmd.OpenReport
method has a WindowMode argument that can be used to open the report in
dialog mode, in which case the code will automatically pause while the
report's preview window is open, and only resume after the window is closed
or hidden.

DoCmd.OpenReport strDocName,acViewPreview, _
WindowMode:=acDialog
 
B

Becky

Dirk - that was it perfectly!

I'd looked all through VBA help, but I often seem to have trouble finding
things there. The Answer Wizard draws a blank for acWindowMode, acDialog,
WindowMode.....etc.

Thanks again - Becky
 
Joined
Jan 3, 2012
Messages
1
Reaction score
0
This is great except the paused print preview is modal. Is there a way to allow the current preview to be printed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top