* YourAppMain.prg on shutdown CloseFormOrEnd() do mymenu.mpr read events return function CloseFormOrEnd() if ( _screen.FormCount = 0 ) * no forms open, shutdown the whole app on shutdown clear events else if ( _screen.ActiveForm.QueryUnload() ) _screen.ActiveForm.Release() endif endif>Thank you very much for your help! You are right about ON SHUTDOWN. However, I am not exiting FoxPro, I am just trying to exit the form and return to the FoxPro system menu to choose another option. Hence, the ON SHUTDOWN command is not activated by trying to exit the form.