Obscured report previews

P

Peter Hallett

Form B is opened by the VBA of Form A. Form B has a command button which
previews Report P. If Form B is opened in dialog mode then the report
preview is obscured beneath Form B and is therefore unreadable. I can find
no way of forcing it to display ‘on-top’. The solution is to open Form B,
but not in dialog mode, and then to close Form A. Report P is then displayed
on top of Form B, in the
usual manner.

This is an acceptable solution until Form A is required to open a second
form – Form C – after Form B has been processed and closed. If Form A is
closed, in order to see the preview of Report P, then Form C cannot be opened.

Ideally, both Form B and Form C need to be opened in dialog mode, requiring
a mechanism to force Report P and Report Q, which is previewed by Form C, to
display as pop-ups. I cannot see how to do this.
 
D

Damon Heron

How about using the visible property of the form instead of closing it?
On FormA:
Me.Visible = False
DoCmd.OpenForm "FormB", acNormal, , , acFormEdit, acDialog

then in formB:
Me.Visible = False
DoCmd.OpenReport "ReportP"

and the close event of the report:
Private Sub Report_Close()
Forms!FormB.Visible = True
End Sub

Damon
 
P

Peter Hallett

Thanks for the suggestion, Damon. I had thought of doing something like that
but unfortunately hiding the form has some drawbacks which make it a less
than ideal solution. However, your comments made me take a closer look at
the report and its code and led me to an embarrassing discovery. I had set
the popup property to ‘Yes’ on a closely related and similarly named report,
rather than the one intended. No wonder it did not work! Silly me.

It does, however, leave one mystery unexplained. It is difficult to
understand why, when a control on Form B is clicked, Access should relate the
resulting action to Form A, from which Form B was called. There can be no
doubt to which form the report preview belongs and which form has the focus
at the time of the call. It should therefore be unnecessary to set the popup
property in order to make the report visible. Another of Access’s
‘features’, it would seem.

So, even if I do not need to adopt your solution, you can take credit for
making me re-examine the report and its code. Without that, I could have
been scratching my head for hours yet.
 

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