Set the button's Cancel property=.t. and then in your valid:
if ( lastkey() = 27 )
return .t.
else
* your other normal validation code goes here.
endif
I've gotten away from control level validation and gone to form level validation at "save time" it allows the user work much more naturally.
>Hi David,
>
>Here's the situation...
>I have a text box valid that checks the user input and if the data is invalid it will bring them back to the same text box. I used the RETURN 0 to bring them back to the text box. The problem is that the user cannot leave the text box until valid data is entered. Suppose the user wants to just exit instead. They cannot because the text box will not allow them to leave unless some valid data is entered. Someone said to use SYS(1270) to check to see if the user has the mouse over the cancel button. This works but do you have a better way than using this method?
>
>Any input helps...
>
>Thanks, Mike.