Stop execution of VBA while report is open

I

insomniux

Hi,
I need to open a report in preview mode from a popup window in modal
mode. Since the report can be openen from more than 1 form, I prefer to
handle making invisible and visble from within the calling form (in
previous discussions the set visible=true command is in the
report.OnClose event).
When I use the next code, the form is set to visible directly after the
report is opened:


Me.Visible = False
DoCmd.OpenReport "FormName", acViewPreview
Me.Visible = True

Is there a way to let the module wait until the report is closed again
(like the execution stops at an MsgBox 0).

I use MsAccess 2000
 
A

Allen Browne

No. Access 2000 cannot open a report modally.

Instead, use the Close event of the report to make your form visible again
if it is loaded. You can test IsLoaded to see if it is there. For example,
if the form is named fdlgMyForm, the report's Close event would contain:

If CurrentProject.AllForms("fdlgMyForm").IsLoaded Then
Forms("fdlgMyForm").Visible = True
End If
 
I

insomniux

Thanks Allen,
That works.
Is there also a way to let the module wait until the report is closed?
 
A

Allen Browne

Not in A2000. You could upgrade to A2002 or 2003.

In these versions OpenReport does take a WindowMode argument that lets you
open the report in dialog mode. However, this is rather restrictive (user
can't get to other windows or do anything before closing the report), so
this is not a good way to design an application unless there is a situation
that demands that approach.
 

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