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.
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]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.