>Thanks for your advice. The VFP internal date check still occurs before the Valid event.
>
>Remember, I am not treating the date field as a character field. It is a date field which is why VFP seems to edit it before the Valid
>event.
>
>I inserted SHOW GETs in various events and when I enter and invalid value
>in the date field, I got the following:
>
>1. the computer beeped, the 'Invalid date' VFP message displayed and the
>cursor remained in the field. I could not move out until I entered a valid
>value.
>
>After I entered a valid value,
>2. the show get of the Valid displayed
>3. the show get of the LostFocus event displayed
>4. the show get of the Error event displayed
>
>I then SET NOTIFY OFF and the only difference from above was that the
>'Invalid date' message did not display but I was still stuck in the field
>until I entered a valid value.
>
>Now I'm stuck in this field!
>
>Mario
Mario,
VFP is behaving corrrectly. I always use date firlds for dates. You can do the following in your Valid event:
IF !EMPTY(This.Value)
IF EMPTY(CTOD(DTOC(This.Value))
* Convert the date to character, then back. If the date was invalid
* it will become empty
= MESSAGEBOX("Invalid date")
This.Value = {}
RETURN 0
ENDIF
ENDIF
RETURN .T.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer