Run-time error 2501 when "No Data to display"

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

Hi,

I am getting a run-time error 2501 when my report has no
data to display. I'm using a form to open the report by
selecting criteria. In the instance when there is no data
to display, I get the message "no data", which I've coded
in the "No Data" event of the report, but right after
that, I get the run-time error 2501: "The OpenReport
action was canceled.", and I'm taken to the
statement "DoCmd.OpenReport.." in the code.

Not sure why this is happening, but will appreciate any
help on fixing this.

Thanks!

-Amit
 
The easiest way to handle this is to trap the error. In your error handler
code in the routine that opens the report try

If Err.Number = 2501 Then Resume Next
 
Back
Top