Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bring Report To Front

Status
Not open for further replies.

bigmerf

MIS
Oct 4, 2002
247
US
I need some assistance bringing a report to the front of a form using code. Can it be done?

Essentially what I have is a startup form. When opening the database, this form opens automatically. I then have code asking the user if they wish to print "Report A".

If they answer "yes" the report opens. If they answer "No" nothing happens.

The problem is, when they answer "yes" and the report opens, it's opened in the background and they have to click the window below to bring it up. I'm assuming because the code is finishing the "open" portion of the startup form that it's loading "on top" of the form.

Is there any code that can be run that will bring the report to the front after the startup form is loaded? Or, am I calling the report at the wrong time "OnLoad" or "OnOpen"?

Can anyone help?
 
Hi WLTC:
This is what I did in my db. Its kind of basic but it works great for me.

I assume that you open the report in print preview mode.

In the On click event property of the Yes button in the form
Insert

DoCmd.Close acForm, "YOURSTARTUPFORMNAME"

and in the report
in the ON CLOSE event property
Insert
DoCmd.OpenForm "YOURSTARTUPFORMNAME"

Hope this helps.
 
This is because your form is set PopUp=Yes. You can overcome this without changing it by opening the report with
Code:
 DoCmd.OpenReport stDocName, acPreview[COLOR=red], , , acDialog[/color]
or setting PopUp=Yes of report.
There is a drawback for this that you won't get any menubar or toolbar with the report. At least I am not success. I have success on assigning a shortcut menu.
If you set the startup form popup=no then nothing is necessary.


Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Yes, both ideas worked to some extent and I appreciate your input.

Let me ask this questions:

Is there any code that I can run that will maximize a report or form rather than the docmd.maximize? The docmd.maximize will only maximize the current form/report.

Here is my code:
--------------------------------
Dim RepPrint As Integer

DoCmd.Maximize

RepPrint = MsgBox("Do you wish to view report??", vbYesNo, "View Report")

If RepPrint = vbYes Then
DoCmd.Minimize 'minimizes main form
DoCmd.OpenReport "7 Day delivery report", acViewPreview
End If
--------------------------------
I want to minimize the main form and maximize the report.

I'm looking for code that you can use that can call a specific report or form. I tried to just type [docmd.maximize "Report A"] but a get a debug error.

I guess I'm looking to maximize a certain form or report when there's about 3 forms or reports already open. I want to be able to pick an choose which report or form I maximize rather than Access taking the default/loaded/current form or report.

Is there any way this can happen?
 
Change this
Code:
Dim RepPrint As Integer
[COLOR=blue]DoCmd.RunCommand acCmdAppMaximize[/color] [COLOR=green]'Maximize Application window[/color]
RepPrint = MsgBox("Do you wish to view report??", vbYesNo, "View Report")
If RepPrint = vbYes Then
DoCmd.Minimize 'minimizes main form
DoCmd.OpenReport "7 Day delivery report", acViewPreview
End If

Put this on the OpenEvent of the "7 Day delivery report"

Code:
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
End Sub

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top