Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-09
11
Medium Priority
?
360 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 1000 total points
ID: 36514396


open the report in dialog mode

DoCmd.OpenReport "reportName", acViewPreview,,,acDialog
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 1000 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

715 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