Making a report open in front of open forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am opening a report via VB code, using DoCmd.OpenReport. It works great,
but it always opens the report behind several other forms that may be open at
the time. I would like it to be opened in front of (on top of) everything
else that's open. Are there any options like this out there? I couldn't
find any.
 
It might be that the forms have their pop up property set to yes. If that is
the case then the form will be in front of the report. If you set the form to
not be a pop up then the report will show in front of the form when you run
the docmd.openreport.
 
I am opening a report via VB code, using DoCmd.OpenReport. It works great,
but it always opens the report behind several other forms that may be open at
the time. I would like it to be opened in front of (on top of) everything
else that's open. Are there any options like this out there? I couldn't
find any.

The form may have been opened in Dialog.
If you are using Access 2002 (or possibly Access 2000) or newer open
the report in dialog.
DoCmd.OpenReport "ReportName", acViewPreview, , , acDialog
 
I'm using Access 2000 and it doesn't have that last parameter as an option.
I can't find any other reference to it throughout the help file. Do you know
another way to set that option?
 
I'm using Access 2000 and it doesn't have that last parameter as an option.
I can't find any other reference to it throughout the help file. Do you know
another way to set that option?

Why do you have all those other forms open.
Usually, if a form is opened in dialog (i.e. as a parameter form), it
is made not visible when the parameters have been entered, then closed
when the report closes.
 
I am in fact making the form that initialtes the opening of the report close
after it opens the report. But there may be other forms open at the time.
The other forms are for other tasks that the user may be doing. I don't
force them to close the other forms just so they can go to open and print a
report. But if they do go to open a report I would like it to be on top of
the other forms since it's the current task they are doing.
 
Nope, it's not a Popup or Modal form. Any other ideas?

If your forms open are not set as popup, then the only thing I can think of
is that the report is ALREADY open.

If you run some code to open a report else where, and hide the report, then
if you use openReprot, the report becomes visible, but will NOT be on top of
everything else.
 
I just double checked them all and none are Popup or Modal. And it happens
when it's the first time the report is opened.

I've been trying to do a SetFocus for the report that was just opened, but
because it's doing in dynamically from a list box based on the currently
selected row (thus report) to open, I don't have a specific report name so I
can't figure out the syntax to SetFocus when you are using the .Value
property.

My code looks like this:

With Me!lstReportList
If IsNull(.Value) Then
MsgBox "Please select a report first!"
Else
'Open the selected report
DoCmd.OpenReport .Value, acViewPreview
'Close the select report form
DoCmd.Close acForm, "Report List", acSaveNo
' Set focus to the just opened report
'.Value SetFocus -- this is the syntax I can't figure out
End If
End With
 
Back
Top