Report Opens behind Form

Niyx

Registered User.
Local time
Today, 10:46
Joined
Feb 19, 2008
Messages
10
Hello all

Once again I've been trawling the web for a solution to this without success.

I have a form (dialog box) that opens a report using the code
Code:
Private Sub cmdOK_Click()
DoCmd.OpenReport strReportName, acViewPreview
DoCmd.Close acForm, "frmYearSelector"
End Sub

the problem I have is that the report opens behind my switchboard which I always want to be visible.

I do not have popup or modal options in the properties of my report and it doesn't work in the code for the report if i try to change the popup property there.

I initially solved this by closing the form in the open event of the report this worked, until I turned the query behind the report into a parameter query, so if i use this method now it asks for parameter value when it opens the report even though i have already selected it on the form I use to open the report

has anyone got any ideas on how to get the report to open on top?

Many Thanks
Niyx
 
You have to minimize the form where you are entering the required parameters. Do this before opening your report. This way, the form and its controls stays in memory and your report will not ask for the parameters
the second time.

On closing your report, issue another command opening your minimized form and it will come up again.
 
I have a form (dialog box) that opens a report using the code
Code:
Private Sub cmdOK_Click()
DoCmd.OpenReport strReportName, acViewPreview
DoCmd.Close acForm, "frmYearSelector"
End Sub
Are you sure you aren't referring to the concept of "on top" as "got focus"??? Objects appear inactive if they do not have the focus.
the problem I have is that the report opens behind my switchboard which I always want to be visible.
Is the switchboard a form or an actual switchboard created by the program?
I do not have popup or modal options in the properties of my report and it doesn't work in the code for the report if i try to change the popup property there.
Setting either of these options will probably get the focus to your report. Popup objects appear on top of all other objects (except modals). So do modals, but the difference is where you can navigate to with both of them. Modal objects don't let you do anything else on the screen until you close them.
it asks for parameter value when it opens the report even though i have already selected it on the form I use to open the report
If your parameter values are indeed filled out in the form when the openreport code runs, than this shouldn't be happening. There may be another issue that's involved here...
 
You have to minimize the form where you are entering the required parameters.
I disagree. Forms don't have to be minimized in order to pass parameter value to other objects on open. The values just have to be there.
 
Adam thanks for all the comments,

Are you sure you aren't referring to the concept of "on top" as "got focus"???
I may be, I am unfamiliar with "got focus". how do you use it to put the focus on a report?

Is the switchboard a form or an actual switchboard created by the program?
The switchboard is a form I have created, i have set the modal and popup values to false.

If your parameter values are indeed filled out in the form when the openreport code runs, than this shouldn't be happening. There may be another issue that's involved here...
The report opens fine (doesn't ask for parameter values again) if I don't close the form or if I close the form in it's own code, it only asks for the parameter values when I try to close the form in the open event of the report. Is there code which could tell it to complete the opening process before actioning the code in the open event(closing the form with the paremter value in)?

thanks for all the help
Niyx
 
Toggle the .Visible property of the forms

Hi Rich

I don't want to do that because I always want my switchboard to be visible and i want to close the form where the user selects the parameter values once they have clicked on ok to run the report.

Niyx
 
The form has to stay open while the report loads, it's easier just to hide it as suggested
 
Problem solved!

I had Modal set to yes for the form where the user selects the parameter value, I have taken this off and instead set the popup value to yes. Now the report opens on top.

Thanks for all your help
Niyx
 

Users who are viewing this thread

Back
Top Bottom