Report displaying behind form

M

mr3316a

In my Access 2007 application I have a form that opens a report in "Print
Preview" mode using the code:
DoCmd.OpenReport "report name", acViewPreview
My problem is that the form where the report is launched from has its
properties set as a Pop Up with modal being set to No.
I have it set this way to hide access to the navigation pane from the user!
What happens when the report opens in Print Preview is it opens behind the
form and it can't be seen.
Can anyone give me some ideas on how to make the report visible to the user
without changing the properties of the form from Pop Up?
 
J

Jeff Boyce

Those requirements kinda tie our hands ...

What about the idea of having the code that opens the report turn off the
pop-up on the form, and when the report is shut down, it re-starts the
form's pop-up?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
F

fredg

In my Access 2007 application I have a form that opens a report in "Print
Preview" mode using the code:
DoCmd.OpenReport "report name", acViewPreview
My problem is that the form where the report is launched from has its
properties set as a Pop Up with modal being set to No.
I have it set this way to hide access to the navigation pane from the user!
What happens when the report opens in Print Preview is it opens behind the
form and it can't be seen.
Can anyone give me some ideas on how to make the report visible to the user
without changing the properties of the form from Pop Up?

Code the form's Command Button Click event:
DoCmd.OpenReport "report name", acViewPreview
Me.Visible = False

Then code the Report's Close event to either close the form:
DoCmd.Close acForm , "FormName"

or if you still need it, make it visible again:

Forms!FormName.Visible = True
 
M

mr3316a

The Report does have its properties set to Pop Up with modal being set to
Yes, and it still opens in the back.
 
M

mr3316a

This noesn't work it causes a dll error because I don't think visible is not
a property of a form.
I there code that can cause Access to minimize while the report is open in
print preview then in the reports close event have it maximize?
 
M

mr3316a

My mistake, it does work -- Thanks
However, when the form becomes visible = false, the user has visibility and
access to the navigation pane.
I think my best solution would be to cause Access to minimize while the
report is open in print preview then in the reports close event have it
maximize.

Any ideas how to do this in code?
 
M

mr3316a

I have solved my problem and would like to thank everyone for their ideas.
Here is my solution:
In the options for the current database:
1. Navigation Display Option = false.
2. Allow Full Menus = false
3. Allow Default Shortcut Menus = false

Now when the forms visibility properity is set to false the user only
sees the report in print preview.

In the form module when the Command Button that displays the report in
print preview:
1. The forms visibility is set to false
2. A Public Sub is called passing 2 values that the user choose
from combo boxes on the form which selects which report to open.
Private Sub cmdPgOPreviewJobTicket_Click()
Dim sm As Long
Dim sl As Long
sl = Me.Controls("cboShipL").Value
sm = Me.Controls("cboShipM").Value
Me.Form.Visible = False
jobTicketPreveiw sm, sl
End Sub

In the Reports close event a Public Sub is called passing a numeric
parameter.
Private Sub Report_Close()
onReportClose 1
End Sub

In the Public, the parameter is used in a select case statement where I
can exacute any code I wish.
In this case it changes the visible properity of the form back to true.
Public Sub onReportClose(C As Integer)
Select Case C
Case 1:
Forms!frmOrderEntry.Visible = True
End Select
End Sub
 

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