Yes, tens of reasons, but why you don't want to assign {} to the value to have VFP native validation or use the class I pointed you to, since I know it works (though you may need to change ErrorMsg to messagebox)?
>To solve the problem I defined the following local variables
>
>Thisform.txtTransDate.Value is the date entered by the user.
>
>
>ldDate = Thisform.txtTransDate.Value
>ldDateType = VARTYPE(ldDate)
>ldDate = IIF(ldDateType = "D" , DTOC(ldDate) , ldDate)
>lnMonth = MONTH(CTOD(ldDate))
>lnDay = DAY(CTOD(ldDate))
>lnYear = VAL(IIF(EMPTY(ALLTRIM(RIGHT(ldDate,4))),'0',RIGHT(ldDate,4)))
>lnLenYear = IIF(EMPTY(lnYear),0,LEN(ALLTRIM(STR(lnYear))))
>
>and do the following test
>
>IF lnMonth = 0 OR lnDay = 0 OR lnYear = 0 OR lnLenYear <> 4
> error processing and message
>ENDIF
>
>
>Is there a reason that the above would not work?
>
>Thanks for all the suggestions
If it's not broken, fix it until it is.
My Blog