Sorry for asking but I could not find any response and can only loop thru 25 pages every so often. I know this has been asked multiple times, but I cannot seem to find an answer that I haven 't used.
I use this type of coding when no data exists for a report, but on occasion, My error trapping does not work. I can see no rhyme or reason why it wouldn't.
MY CODE INSIDE THE REPORT MODULE IS:
Private Sub Report_NoData(Cancel As Integer)
Cancel = True
MsgBox "No Data To Report", vbExclamation, "Print Current Report"
End Sub
MY CODE FOR THE CLICK EVENT ON THE FORM THAT GENERATES THE REPORT IS:
Private Sub cmdPrintCurrent_Click()
On Error GoTo print_Err
DoCmd.OpenReport "rptUnprintedTimeReports", acViewPreview
print_Exit:
Exit Sub
print_Err:
Select Case Err.Number
Case 2501 ' openreport closed by user
Resume Next
Case Else
MsgBox "Error Number: " & Err.Number & vbCrLf & _
"Error Source: '" & Me.Name & ":cmdPrintCurrent_Click" & vbCrLf & _
"Error Message: " & Err.Description, vbCritical, "Error Printing Report!"
Resume print_Exit
End Select
end sub
ANY IDEAS?????
AL