By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

Another stupid error 2501 question in REPORTS

P: 7
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
Jul 25 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.