Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

**ISDate() Function ?!

Status
Not open for further replies.

PogoWolf

Programmer
Mar 2, 2001
351
US
Hey All! =)
I'm wordering..its there a function in VFP 3.0 like the VB Command of 'IsDate' to check to make sure that a date entered into a text field is a Correct date?
---===///The PogoWolf\\\===---
Amateurs built the ark, Professionals built the Titanic.
 
You can use CTOD():

holdit = myTextbox.value
holdit = CTOD(holdit)
IF EMPTY(holdit)
*** bad date
ELSE
*** good date
ENDIF

Jim
 
Beware also that the D format allows invalid dates, such as 45/45/45, to be entered.

Jim
 
Jim

Well spotted - you are right!

You could use a combination of THISFORM.Text1.Format = [D] and validate the date in the .LostFocus or .Valid events, returning the user to the textbox if the date was invalid.

Chris :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top