>Hello:
>
>I'm trying to force users not to enter dates before 1900 into a text box.
>
>I have the following code in the valid event but it won't allow
>me to enter any dates now. Dates entered, i,.e. 1965/09/08 give me invalid input.
>
>Local llpastdate
>llpastdate = this.value < {1900/01/01}
>
>
>
>If llpastdate
>=messagebox("You cannot enter a century befpre 1900")
>Endif
>return llpastdate
Hi Sheena,
First prefer lostfocus for validation (valid is more problematic).
Dateformat might not be in YYYYMMDD thus returning an emptydate better use strictdate formats and expressions as {^1900/01/01}.
Return dDate in valid is not a valid option. Return num or logical expression.
If you need to check only dates are not before 1900 then use year() to check.
if year(this.value) < 1900
nodefault
messagebox("You cannot enter a century before 1900")
endif
Cetin