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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 2501?????

Status
Not open for further replies.

bpifer23

MIS
Mar 2, 2004
14
US
In my database, when opening reports this error comes up occassionally. It does not happen all the time but it does happen. The error saysm "Run Time Error 2501". I am usind VB code attached to my command button to open the report. The code is as follows......

Dim strReportName As String, strFilter As String
strReportName = "TeDaysReport"
DoCmd.OpenReport strReportName, acViewPreview, , strFilter

Any help would be great!!!
Thanks, Brian
 
You probably also have coded the NoData event in the report to cancel the report if there are no data. That creates the 2501. I think it might also occur when there's something wrong with the criteria, but I'm not 100% sure.

Then within this code, include some errorhandling, for instance:

[tt]on error goto myerr
Dim strReportName As String, strFilter As String
strReportName = "TeDaysReport"
DoCmd.OpenReport strReportName, acViewPreview, , strFilter
myexit:
exit sub
myerr:
if err.number<>2501 then
err.description
end if
resume myexit
end sub[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top