Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yu-Wah Cheung
  Where is Yu-Wah Cheung?
 
 United Kingdom
 Yu-Wah Cheung
 To: Suvi Joseph
  Where is Suvi Joseph?
 Bangalore
 India
 Suvi Joseph
 Tags
Subject: RE: date problem
Thread ID: 15797 Message ID: 15870 # Views: 2 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Wednesday, October 02, 2002 6:19:05 PM         
   


> > hello Suvi Joseph,
> >
> > what r u give me is just how to create the date but not the validation, what i want it the program check the date if user key in the wrong date, u know what i mean. example if user key in the date dd/mm/yyyy (31/2/2002) the prg will display out the errro message coz february no 31 day........i think now u know what is my problem now..
> >
> > hope to get the answer soon
> >
> >
> >
> >
> >
> > > > > >hello,
> > > >
> > > > what i mean is that the program will prompt the users to key in the date, if the users key in the wrong date format the program will display out the message that the date key in by the user is invalid, what is the format of doing this?
> > > >
> > > >
> > > >
> > > >
> > > > hello,
> > > > > >
> > > > > > can sameone tell me how can i check whether the date entering is valid or not
> > > > > > eg. the month is between 1-12 and each month have how many day.
> > > > > > can sameone tell me how was the coding or any method that i can check it so the program will display out the message if the date is invalid.
> > > > > >
> > > > > > thank
> > > > >
> > > > > If you are talking about in VFP, you can simply do this way:
> > > > > 1. Put a variable, lets say 'date1' in the text box's Controlsource property
> > > > > 2. Enter D in the Foramt property of the text box.
> > > > > 3. put this code
 date1=ctod("  /  /  ") 
in the init event of your form. and say
 thisform.refresh 

> > > > > If you run this. It will automatically take the valid date. If you have any difficulty in doing this. Let me know.
> > > > > Regards,
> > > > > Suvi Joseph
> > >
> > > I uploaded a sample.
> > > https://www.foxite.com/uploads/s00u9uxf.zip
> > > Regards,
> > > Suvi Joseph
>
> Just try giving the INVALID DATE in that program. It will give an error message. This is done automatically. No other code is required.
> HTH.
> Regards,
> Suvi Joseph

VFP has internal Date checking if you have SET NOTIFY ON. This is automatically switched on when SET NOTIFY ON and controlsource of the textbox is of type DATE or DATETIME. When a date of {31/02/2000} is enter a wait window 'Invalid Date' will be displayed.

The other way to do this is answered in another thread which I cannot remember. It basically says that you set the Textbox as a Character and then evaluate the Value in the VALID event. This entails that you donot set the ControlSource because this is what triggers the automatic date checking.

Hope this helps.

On another note, I have noticed that if the Form is Modal, my solution of SET NOTIFY ON does not work. Anyone got any ideas ?

Regards

Yu-Wah Cheung

ENTIRE THREAD

date problem Posted by Tay Chin Phang @ 10/1/2002 6:52:45 AM
RE: date problem Posted by Suvi Joseph @ 10/1/2002 7:26:07 AM
RE: date problem Posted by Tay Chin Phang @ 10/1/2002 9:22:47 AM
RE: date problem Posted by Suvi Joseph @ 10/1/2002 2:10:34 PM
RE: date problem Posted by Tay Chin Phang @ 10/2/2002 9:24:18 AM
RE: date problem Posted by Suvi Joseph @ 10/2/2002 10:11:19 AM
RE: date problem Posted by Yu-Wah Cheung @ 10/2/2002 6:19:05 PM