Form.QueryUnload IF &&we can unload the form now RETURN .T. ELSE NODEFAULT RETURN .F. ENDif Form.cmdQuit.Click IF ThisForm.QueryUnload() ThisForm.Release() ENDifIn this case, you'd probably want to put the code releasing the object in either the QueryUnload or (better) a custom method called from QueryUnload.