LOCAL llReturn thisform.lIsClosing = .t. if type('THISFORM.ActiveControl') = 'O' and not ; isnull(thisform.activecontrol) and PEMSTATUS(thisform.activecontrol,'valid',5) ; and inlist(lower(thisform.activecontrol.baseclass),'textbox','editbox') thisform.activecontrol.valid() endif llReturn = .t. lnReply = This.AskToSave() IF lnReply = IDCANCEL OR lnReply = IDMUSTKEY *------------------------------------------- *--- Reset the nGoToPageOnCancel property *--- if it has been changed. *------------------------------------------- IF lnGoToPageOnCancel != 0 This.nGoToPageOnCancel = lnGoToPageOnCancel ENDIF *** Deny form to be closed. NODEFAULT m.llReturn = .f. &&RETURN .F. **** ENDIF thisform.lIsClosing = .f. RETURN m.llReturnSo, I think there is no problem with your code.