Hi, Alex.
I prefer Gerald idea.
Check lastkey() = 27 is not good.
If the user click the textbox but don't fill anything and go away to next control,
validation BLAME him and request date filled.
but the user still may think he want take a look record only!
* txtEntryDate.valid()
IF empty(this.value)
return .T.
endif
* other validation rules below
For my habit, I use lostfocus instead of valid event.
Wrong date input request user to press
Space to re-edit the field.
All other keys are ignored until user press space,
of cos, this is very inconvienient to user.
>OK, perhaps that's not the best title, but I'm looking for ideas here...
>
>I have a text box on a form for the user to type the date.
>
>The date is valid ONLY if it's < date() .and. > date() - 120
>
>The default value is blank. I NEED users to actually enter the date even if it's today.
>
>The problem I'm having is that if the user opens the form and decides not to input anything, and click on the CANCEL button, the text box's valid event fires, and until the user enters a date, he won't be able to cancel.
>
>If he presses the ESC key, he's able to leave the form and validation doesn't fire.
>
>Any way to bypass the valid event if the user clicks the Cancel button?
>
>Discuss amongst yourselves...
>
>Thanks!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.