P
Paul
Hi All,
I built a form called Reports and I want to add a Option
button or Label once it clciks it will prompt the user for
a Start Date and End Date:
My current code for my form is below. I havie been using
the NorthWInd Datbase as my guide. Any suggestions?
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and Print_Click
Sub procedures.
' Preview or print report selected in the
ReportToPrint option group.
' Then close the Reports form.
Dim strWhereCategory As String
strWhereCategory = "CategoryName = Forms![Reports]!
SelectCategory"
Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "Report1", PrintMode
Case 2
DoCmd.OpenReport "Report2", PrintMode
Case 3
If IsNull(Forms![Reports]!SelectCategory) Then
DoCmd.OpenReport "Report3", PrintMode
Else
DoCmd.OpenReport "Report3", PrintMode, ,
strWhereCategory
End If
End Select
DoCmd.Close acForm, "Reports"
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
I built a form called Reports and I want to add a Option
button or Label once it clciks it will prompt the user for
a Start Date and End Date:
My current code for my form is below. I havie been using
the NorthWInd Datbase as my guide. Any suggestions?
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and Print_Click
Sub procedures.
' Preview or print report selected in the
ReportToPrint option group.
' Then close the Reports form.
Dim strWhereCategory As String
strWhereCategory = "CategoryName = Forms![Reports]!
SelectCategory"
Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "Report1", PrintMode
Case 2
DoCmd.OpenReport "Report2", PrintMode
Case 3
If IsNull(Forms![Reports]!SelectCategory) Then
DoCmd.OpenReport "Report3", PrintMode
Else
DoCmd.OpenReport "Report3", PrintMode, ,
strWhereCategory
End If
End Select
DoCmd.Close acForm, "Reports"
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub