Closing report on error without printing

B

Bob

I have a report in which some code executes withing a transaction during the
page print event, which occurs according to the docs, just before the page
is actually printed. If an error occurs in my code execution I want the
report to close without printing that page. However I find that the report
closes bit the page gets printed anyways. I also see as I steep through my
code when I get to the statement Docmd.close acReport, "MyReport" (which I
do when I trap and error), I get an error message saying this command or
macro can not be executed while I'm debugging or using the IDE.
So how do I interrupt a report without printing it if I trap an error in
code? (Using access 97)

Thanks for any help,
Bob
 
Top