Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem in date counting
Message
 
 
To
13/05/2007 14:39:19
Chandan Chakraborty
Bangiya Gramin Vikash Bank
Raiganj, India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01225093
Message ID:
01225095
Views:
13
This message has been marked as a message which has helped to the initial question of the thread.
Hi,

I'm not sure I follow exactly your logic, but here are some points:

1. It's better to put validation into the Valid method of your date textbox, not into keypress method.

2. If you want to check entered date to be in the range of current date, date - 6 months, you may use something like this:
ldMinDate = gomonth(date(),-6) && 6 months prior to the current date
ldMaxDate = date()

if not between(thisform.txtDate.value, m.ldMinDate, m.ldMaxDate)
   =messagebox(...)
   return 0 && to keep the focus on the date field
endif
>Hello All,
>
>I have two date field. The date of date2 must not be
>greater than date1.
>
>In the keypress of date2 I have wrote:
>
>
>
>ldDate3=ctod(" / / ")
>
>ldDate3=(thisform.ldate.value) - thisform.ldDate2.value)
>
>if thisform.ldDate.value>ldDate3
>
>messagebox("Collection Date Exceeds 6 months",0+64,"Hello!")
>
>endif
>
>
>
>But I am not getting the desired result. Before completely fiiling
>the date2 field the message box is appreaing.The messagebox
>appearing just after entering the month.And it is going to the next
>field which I want to stop.
>
>Please help me.
>
>Chandan
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform