Solved

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

Posted on 2011-09-09
11
349 Views
Last Modified: 2012-08-13
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
Comment
Question by:Eric Sherman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 34

Expert Comment

by:Norie
ID: 36514269
Are you closing the form as well as opening the report?
0
 
LVL 19

Author Comment

by:Eric Sherman
ID: 36514279
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 36514396


open the report in dialog mode

DoCmd.OpenReport "reportName", acViewPreview,,,acDialog
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 250 total points
ID: 36514408
You can cheat by setting the *Report's* Popup property to: Yes

0
 
LVL 19

Author Comment

by:Eric Sherman
ID: 36514431
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36514464
Did you try the code I posted?
0
 
LVL 19

Author Comment

by:Eric Sherman
ID: 36514504
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
 
LVL 19

Author Comment

by:Eric Sherman
ID: 36514510
<<<<<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
 
LVL 19

Author Comment

by:Eric Sherman
ID: 36514540
Capricorn1 ... Below is the error I receive while running the code you posted.

ET
VBError.png
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36514678
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36514695
....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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question