urjudo
asked on
Access coding
Hi Experts,
I have a coding question that need help. below is my code:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Dim rs As Recordset
Dim db As Database
Dim stDocName As String
Dim stLinkCriteria As String
Form_frmPrintedReportsAll. BeginDate = Me.BeginDate
Form_frmPrintedReportsAll. EndDate = Me.EndDate
If IsNull(BeginDate) Or IsNull(EndDate) Then
MsgBox "Please enter Begin Date and End Date before proceeding."
Exit Sub
Else
stDocName = "rptStatsFor830CL2B"
On Error Resume Next
DoCmd.OpenReport stDocName, acPreview
If Err.Number = 2501 Then
Else
Form_frmPrintedReportsAll. Visible = False
End If
stDocName = "rptStatsFor830CL2A"
DoCmd.OpenReport stDocName, acPreview
Form_frmPrintedReportsAll. Visible = False
End If
Exit_Command11_Click:
DoCmd.Close acForm, "frmParmStatsFor830CL2"
Exit Sub
Err_Command11_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command11_Click
I would like to skip the message from rptStatsFor830CL2B if there is no data. I have a no data to report message on both reports but rptStatsFor830CL2B not always has data, when I ran the code, it gave me the message "No data to report" when rptStatsFor830CL2B is blank then print out rptStatsFor830CL2A. what should I do if rptStatsFor830CL2B has no data then skip the message and print the rptStatsFor830CL2A ?
Thanks
End Sub
I have a coding question that need help. below is my code:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
Dim rs As Recordset
Dim db As Database
Dim stDocName As String
Dim stLinkCriteria As String
Form_frmPrintedReportsAll.
Form_frmPrintedReportsAll.
If IsNull(BeginDate) Or IsNull(EndDate) Then
MsgBox "Please enter Begin Date and End Date before proceeding."
Exit Sub
Else
stDocName = "rptStatsFor830CL2B"
On Error Resume Next
DoCmd.OpenReport stDocName, acPreview
If Err.Number = 2501 Then
Else
Form_frmPrintedReportsAll.
End If
stDocName = "rptStatsFor830CL2A"
DoCmd.OpenReport stDocName, acPreview
Form_frmPrintedReportsAll.
End If
Exit_Command11_Click:
DoCmd.Close acForm, "frmParmStatsFor830CL2"
Exit Sub
Err_Command11_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command11_Click
I would like to skip the message from rptStatsFor830CL2B if there is no data. I have a no data to report message on both reports but rptStatsFor830CL2B not always has data, when I ran the code, it gave me the message "No data to report" when rptStatsFor830CL2B is blank then print out rptStatsFor830CL2A. what should I do if rptStatsFor830CL2B has no data then skip the message and print the rptStatsFor830CL2A ?
Thanks
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER