• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

Open a Report with Form Open Event and Display in front of the Form???

I have a main form that opens with the application.  I have added a "Alerts" report for certain information that will be displayed each time the user logs in thus loading Form1.  Form1's Open Even will open the Alerts report in preview mode.  The problem is the report opens behind Form1 making it useless right now.  

I've tried DoCmd.SelectObject acReport, "Report", False  after the DoCmd.OpenReport code to no avail.  Form1 is not Modal nor is it set to remain on top of all other forms.

Any ideas will be appreciated.

Thanks,

ET
0
Eric Sherman
Asked:
Eric Sherman
  • 5
  • 3
  • 2
  • +1
2 Solutions
 
NorieVBA ExpertCommented:
Are you closing the form as well as opening the report?
0
 
Eric ShermanAccountant/DeveloperAuthor Commented:
No, Form1 is the main form that controls the application.  The "Alerts" report should display (Preview Mode) after the user has logged in, From1 loaded.  The user can review it or print it then close it down.  It works, it just opens each time behind Form1.  I'm sure there's some way to make the report display on top of the form .... not behind it.

ET
0
 
Rey Obrero (Capricorn1)Commented:


open the report in dialog mode

DoCmd.OpenReport "reportName", acViewPreview,,,acDialog
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Jeffrey CoachmanMIS LiasonCommented:
You can cheat by setting the *Report's* Popup property to: Yes

0
 
Eric ShermanAccountant/DeveloperAuthor Commented:
I ran across those recommendations earlier but in Access 2k ... the acDialog and the Popup Property is not available.  

I can use the DoCmd.Minimize in Open Event on Form1 and now I'm trying to Restore Form1 using the OnClose Event of the Report to no avail.

Forms!Form1.Restore or Forms!Form1.Maximize doesn't seem to work.

Any ideas ...

ET
0
 
Rey Obrero (Capricorn1)Commented:
Did you try the code I posted?
0
 
Eric ShermanAccountant/DeveloperAuthor Commented:
Thanks all for the Replies and I'm sure the two solutions will work in later versions of Access just not 2000.  I will use them there.  

Here's what worked Access 2k.

In From1 Open Event before the report opens ...

DoCmd.Minimize
DoCmd.OpenReport "Report1", acViewPreview


In Report1 OnClose Event .....

If CurrentProject.AllForms("Form1").IsLoaded = True Then
    DoCmd.SelectObject acForm, "Form1"
    DoCmd.Restore
End If


I like the two solutions provided by capricorn1 and boag2000 simply because it's less code and will use them later on but the method above works with Access 2k.

Thanks,

ET Sherman
0
 
Eric ShermanAccountant/DeveloperAuthor Commented:
<<<<<Did you try the code I posted?>>>>>

Yes, I got a VB Error and on the Report Properties ... there's not PopUp Setting available.  I assume you are using a later version than 2000.

ET Sherman
0
 
Eric ShermanAccountant/DeveloperAuthor Commented:
Capricorn1 ... Below is the error I receive while running the code you posted.

ET
VBError.png
0
 
Jeffrey CoachmanMIS LiasonCommented:
LOL

Yeah, I presumed Acc 03 or higher...

I have seen this, but I don't know if it is applicable (or practical)
http://support.microsoft.com/kb/209938
0
 
Jeffrey CoachmanMIS LiasonCommented:
....is it possible to just change the location of the code that opens the report?

ex. something like this:
 
If Report Needs to Show
    OpenForm
    OpenReport
Else
    OpenForm
end if
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now