Hi Allan,
If the code in the Error routine simplies issues a return at the end, then that is why it is returning to the line directly after thge error line. You need to issue something like return to master or some other procedure up the program stack to avoid this.
BTW, the reason, I believe, the form is not releasing is because one of its procedures is still in the program stack. Once you get it out of there, it should release fine. Since it isn't releasing, it remains the ActiveForm and attempts to release FormCount times.
HTH.
>Hi Mark,
>
>I have a global error handling routine that has code to deal with some of the 'common' errors that occur. For all others, when the error occurs, a form appears advising the user that the application will close and I log the specifics of the error in a table for that purpose.
>
>I tried using your code below to close all open forms but for some reason, the form that I had purposefully generated the error from did not close. I stepped through the code and the code in the queryunload event - this.release() - was called - but the form did not close. In fact, after looping through and closing all other forms, the application starting executing the code right below the line of code on the form that caused the error. Any ideas as to why the form that caused the error would not close/release? The windowtype of this form is 0-modeless.
>
>Any assistance would be appreciated.
>
>Al
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao