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!

When no records are returned, #Error 1

Status
Not open for further replies.

KaayJaay

IS-IT--Management
Jul 6, 2004
64
US
I want to know if there is a way that i can prompt the user with a message stating that "The criteria you input returns no records." as opposed to getting #Error on my report, or a blank report.

KaayJaay
 
One of the ways, is using the on no data event of the report.

[tt]msgbox "The criteria you input returns no records."
cancel = true[/tt]

Then in the calling form, include some handling to trap the 2501 error:

[tt]on error goto myerr
docmd.openreport "myrpt"...
myexit:
exit sub
myerr:
if (err.number<>2501) then
msgbox err.description
end if
resume myexit
end sub[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top