>Hi Mike!
>I used your earlier reply to my message about using the return 0 command to return to the text box in case of invalid data. It works great!
>
>I have another question I think you could be of help.
>I used your return 0 in the valid of the text box, but how do I let the user get out if they want to cancel and don't want to enter data. I have a cancel button but the text box will not allow me to exit because it keeps returning the 0 to keep me there.
>Any suggestions?
>Thanks, Mike.
Mike,
Set the Cancel property of your cancel button to .T. That causes pressing the button to be the same as pressing the escape key. (BTW, it also makes pressing the escape key run the code in your cancel button's click event).
Now, in the valid of your textboxes you can;
IF LastKey() = 27
RETURN
ENDIF