Close report while processing

golgo1

Registered User.
Local time
Today, 17:58
Joined
Feb 8, 2002
Messages
17
I want to close a report if conditions occur at the DETAIL level. Access won't let me docmd.close while the report is still being generated. I have to wait until the entire report is finished to close. Any way around this? Calling the Report_close sub doesn't work either
 
This is just a crazy thought, but...

In the detail section, when you detect the condition that makes you want to close the report, raise an error. (Look up Help topic "Raise Method" on what and how to do this.)

In the overall report code, have a Report_Error handler that will be called when an error is raised. Have this code try to do the DoCmd.Close rather than letting the Detail_OnFormat (or whatever) try to close it.

In the Err.Raise method, everything but the number is optional - but I would advise including a couple of descriptive strings for the source and description parameters.

Unless you have written your own help file, which requires the SysDevKit, the helpfile and helpcontext items are a lost cause that are no good to you.

Good luck with this one, I'll freely admit I'm just guessing.
 

Users who are viewing this thread

Back
Top Bottom