IF LASTKEY() = 27 && escape RETURN .T. ENDIFThat's it, no more no using sys(1270) to find out the name of the object the mouse is over, no fancy coding all over the place. You simply make the Cancel button the Escape button and the check in your valid code to see if the user pressed escape. This not nly works but is eliminates the question of "How do stop the user from closing my form with the escape button?" Because pressing the escape key is the same as clicking teh cancle button and pressing escape will run the click code of the cancel button and do all those thing you've set up for cancelling.