IF nKeyCode=27 && escape IF VARTYPE(thisform.ActiveControl)=="O" .OR. UPPER(thisform.ActiveControl.BaseClass) # "GRID" ** or If You have two grids if You have two grids - UPPER(thisform.ActiveControl.Name) # "GRID_YOU_WANT_TO_CHECK_NAME" thisform.Release() ENDIF ENDIF