I have a question. Look at the script below. Where it says stDocName and strQueryName how to add multiple entries? When I click on that button to generate the report I would like for multiple reports to pop up.
Private Sub Generate_CCPK_Employee_Discount_Report_DblClick(Cancel As Integer)
On Error GoTo Err_Generate_CCPK_Employee_Discount_Report_DblClick
Dim stDocName As String
stDocName = "CCPK Discount Employees Fulltime1"
Dim stWhere As String
strQueryName = "CCPK Discount Employees"
If Not IsDate(Me.txtBeginning) And IsDate(Me.txtEnding) Then
stWhere = "[trans_date] <=" & SQLdate(Me.txtEnding)
ElseIf IsDate(Me.txtBeginning) And Not IsDate(Me.txtEnding) Then
stWhere = "[trans_date] >= " & SQLdate(Me.txtBeginning)
ElseIf IsDate(Me.txtBeginning) And IsDate(Me.txtEnding) Then
stWhere = "[trans_date] Between #" & Me.txtBeginning & "# And #" & Me.txtEnding & "#"
End If
'MsgBox stWhere
Debug.Print "Beginning: " & Me.txtBeginning & "Ending: " & Me.txtEnding & " StWhere: " & stWhere
DoCmd.OpenReport stDocName, acViewPreview, , stWhere
Exit_Generate_CCPK_Employee_Discount_Report_DblClick:
Exit Sub
Err_Generate_CCPK_Employee_Discount_Report_DblClick:
MsgBox Err.Description
End Sub
Private Sub Generate_CCPK_Employee_Discount_Report_DblClick(Cancel As Integer)
On Error GoTo Err_Generate_CCPK_Employee_Discount_Report_DblClick
Dim stDocName As String
stDocName = "CCPK Discount Employees Fulltime1"
Dim stWhere As String
strQueryName = "CCPK Discount Employees"
If Not IsDate(Me.txtBeginning) And IsDate(Me.txtEnding) Then
stWhere = "[trans_date] <=" & SQLdate(Me.txtEnding)
ElseIf IsDate(Me.txtBeginning) And Not IsDate(Me.txtEnding) Then
stWhere = "[trans_date] >= " & SQLdate(Me.txtBeginning)
ElseIf IsDate(Me.txtBeginning) And IsDate(Me.txtEnding) Then
stWhere = "[trans_date] Between #" & Me.txtBeginning & "# And #" & Me.txtEnding & "#"
End If
'MsgBox stWhere
Debug.Print "Beginning: " & Me.txtBeginning & "Ending: " & Me.txtEnding & " StWhere: " & stWhere
DoCmd.OpenReport stDocName, acViewPreview, , stWhere
Exit_Generate_CCPK_Employee_Discount_Report_DblClick:
Exit Sub
Err_Generate_CCPK_Employee_Discount_Report_DblClick:
MsgBox Err.Description
End Sub