Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validate date in a save method
Message
De
12/04/2007 10:51:16
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01214399
Message ID:
01214988
Vues:
22
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform