Exiting a report using VBA

J

John Baker

Is it possible to exit a report from one of the events of the report?

I have a call to a subprocedure from the report_open event. Depending on
certain values in the subprocedure I would like to be able to end the
report. I tried to do this with a docmd.close command but it wont let me
exit at this point.

Any help greatly appreciated.

John Baker
[email protected]
 
A

Allen Browne

The Report_Open event has a Cancel argument.

Just set that to True to cancel loading the report:
Cancel = True

Note that the report data is not present at this time.
 
Top