T
terri
My (2000 RT) application’s main screen form has code in the Unload event to
handle if the user "accidentally" clicks the X to close the application
instead of the X to close the current window. A message box asks if they
really want to exit, and cancels or continues accordingly. This works just
fine until…
I have situations where I need a report to run when one (or more) forms have
been opened modally using acDialog. To get around the problem of the report
displaying behind the forms instead of on top, I am using the idea from a
code sample by Terry Kreft: 1) loop through the Forms Collection and make
all the forms invisible; 2) display the report; and 3) when the report is
closed, make the forms visible again. This works just fine until…
If the user clicks the X to close the application instead of the X to close
the report window and answers "no" to the exit question, the main form's
Unload event code runs fine through to its exit sub point (the Cancel param
is set to true). Then the "Execution of this application has stopped due to
a run-time error" message displays. The Unload code then runs through a
second time. The application then shuts down regardless of the response.
BTW -- answering "yes" to the exit message originally, the application closes
just fine (without the runtime error).
I thought this may have something to do with the modal state of the forms,
but using the same "hiding" technique with only forms opened with acNormal,
results in the same behavior. Any insight?
handle if the user "accidentally" clicks the X to close the application
instead of the X to close the current window. A message box asks if they
really want to exit, and cancels or continues accordingly. This works just
fine until…
I have situations where I need a report to run when one (or more) forms have
been opened modally using acDialog. To get around the problem of the report
displaying behind the forms instead of on top, I am using the idea from a
code sample by Terry Kreft: 1) loop through the Forms Collection and make
all the forms invisible; 2) display the report; and 3) when the report is
closed, make the forms visible again. This works just fine until…
If the user clicks the X to close the application instead of the X to close
the report window and answers "no" to the exit question, the main form's
Unload event code runs fine through to its exit sub point (the Cancel param
is set to true). Then the "Execution of this application has stopped due to
a run-time error" message displays. The Unload code then runs through a
second time. The application then shuts down regardless of the response.
BTW -- answering "yes" to the exit message originally, the application closes
just fine (without the runtime error).
I thought this may have something to do with the modal state of the forms,
but using the same "hiding" technique with only forms opened with acNormal,
results in the same behavior. Any insight?