Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate date in a save method
Message
From
12/04/2007 10:51:16
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01214399
Message ID:
01214988
Views:
21
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform