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.
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.
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
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