Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debug Message help

Status
Not open for further replies.

Zonie32

Technical User
Jan 13, 2004
242
US
Hi all,

I am using MSAccess 03, win xp.

I have a report form with this option button that runs this bit of code to open the report:

ElseIf [Forms]![Reports Form]![fReportOptions].Value = 9 Then
DoCmd.OpenReport "Cancel Report A", acViewPreview

I added this bit of code to the On NoData Event to let the user know when there are no records, but when I click the Option button and put in the date parameters I get the message no problem, but then another window with a Runtime error 2501 and it asks me to Debug. How do I get that Error message to not show up?

Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ErrorHandler

MsgBox "There are currently no records in that timeframe", vbOKOnly, "No Records"

Cancel = True

ExitHandler:
Exit Sub

ErrorHandler:
MsgBox Err.Description
Resume ExitHandler

End Sub
 
in the event that opens the report:

Private Sub TestNoData_Click()
On Error Resume Next
DoCmd.OpenReport "SomeReport", acViewPreview
If Err = 2501 Then Err.Clear
End Sub


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top