*------Procedure stack at beginning of on shutdown.-------- FORM1.COMMAND3.CLICK TEST2MODAL.COMMAND2.CLICK TEST2AMODAL.COMMAND2.CLICK ON... TERMINATEAPPLICATION *------------------------------- Releasing Form1 Form1 Release code executed Releasing TEST2modal TEST2modal Release code executed Releasing TEST2amodal TEST2amodal Release code executed Releasing TEST2bmodal TEST2bmodal Release code executed TEST2bmodal Unload code executed Forms collection after releaseallforms has released all _screen.forms(1) = TEST2amodal _screen.forms(2) = TEST2modal _screen.forms(3) = Form1 End of Forms collection Form1 QueryUnload code executed TEST2modal QueryUnload code executed TEST2amodal QueryUnload code executedThe UNLOAD event fired only for the one modal screen, but QueryUnload fired for each of the other forms, but not UNLOAD. I noticed the same thing on most other samples I looked at. I changed Quit to CLEAR EVENTS in TerminateApplication and placed CLEAR ALL and Quit just after READ EVENTS in my main program, reran the test program and this is the result.
*------Procedure stack at beginning of on shutdown.-------- FORM1.COMMAND3.CLICK TEST2MODAL.COMMAND2.CLICK TEST2AMODAL.COMMAND2.CLICK ON... ON... TERMINATEAPPLICATION *------------------------------- Releasing Form1 Form1 Release code executed Releasing TEST2modal TEST2modal Release code executed Releasing TEST2amodal TEST2amodal Release code executed Releasing TEST2bmodal TEST2bmodal Release code executed TEST2bmodal Unload code executed Forms collection after releaseallforms has released all _screen.forms(1) = TEST2amodal _screen.forms(2) = TEST2modal _screen.forms(3) = Form1 End of Forms collection TEST2amodal Unload code executed TEST2modal Unload code executed Form1 Unload code executedI use Unload event for clean up code in my forms but it was being skipped on shutdown. Putting clear all and quit in my main procedure after read events instead of ON SHUTDOWN procedure seems to be what I was missing.