Open report from more than one form

koolwaters

Active Member
Joined
May 16, 2007
Messages
403
I have a Report's Menu form in my database where I preview all of the reports in the database.

On the Report's Menu, if I want to view the Facilitator Training Report, I choose the required date period, choose the Training by Facilitator Report from a combo box and click on the Preview Report command button, which opens the Facilitators form so that I can choose the Facilitator whose training information I want to view.

The record source for the report is a query which displays data between the Start and End Dates selected on the Report's Menu.

Code:
Between [Forms]![frmReportMenu]![StartDate] And [Forms]![frmReportMenu]![EndDate]

My problem:
If I am on the Facilitators form and I want to view the Facilitator Training Report and the Report's Menu is not loaded, I get the parameter dialog boxes prompting for the Start and End Dates. I have the OnNoData property of the report set to cancel if there is no data and the OnOpen property set to close the Facilitator's form.

If I cancel the parameter dialog boxes, I am then left with nothing displayed as the Database Window is set to not display at Start up.

Is there any way to be able to view the report?

Below is part of the code for the Preview command button on the Report's Menu and the View Training button on the Facilitator's Form.

Code:
If Me.ctlReports = "Training by Facilitator" Then
If Not CurrentProject.AllForms(frmFacilitators).IsLoaded Then
    DoCmd.OpenForm "frmFacilitators", acNormal, "", "", , acNormal
MsgBox "Please Choose a Facilitator!", vbInformation + vbOKOnly, "Choose Facilitator"
Exit Sub
End If

Code:
Private Sub cmdViewCourses_Click()
If IsNull(Me.ctlFindFacilitator) = True Then
MsgBox "Please choose a facilitator.", vbOKOnly + vbInformation, "Choose Facilitator"
Me.ctlFindFacilitator.SetFocus
Me.ctlFindFacilitator.Dropdown
Exit Sub
End If
On Error Resume Next
DoCmd.OpenReport "Training By Facilitator", acViewPreview, , "[Facilitator]='" & Me.ctlFindFacilitator & "'"
End Sub

I tried playing around with the code but I am not getting the result I want. So basically, if the Report's Menu is not loaded I want to load it, choose the date and then preview the report. When I tried playing around with the code I was basically going from one form to the next but the report would not open.

Please help!
Thanks
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
hi koolwaters (what is your name?)

Take advantage of the WHERE clause parameter of OpenReport...

Rather than having the report take its criteria from the query, show ALL records in the saved version of the report. Then, when you render it, supply the Where clause to limit the records

I see you ARE doing that here ...

DoCmd.OpenReport "Training By Facilitator", acViewPreview, , "[Facilitator]='" & Me.ctlFindFacilitator & "'"

... you are limiting the report to a particular Facilitator
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,351
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top