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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invalid date

Status
Not open for further replies.

samsnead

Programmer
Sep 3, 2005
100
CA
All of our date textboxes have value of {}. If we enter a partial date (i.e. 1/ / ) and then exit or click somewhere else on the form - we get Invalid Date message. Is there a way to bypass this (without changing all our textboxes and building our own date validation)?
 
One way is to initialize the values to DATE() value.

You can use ThisForm.Controls and loop thru them .. find the date type text boxes and set the initial value to DATE() value. This code can be in the init of the form.

Surely there are more ways to do the same thing.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
we do initialize - but then problem occurs if operator enters a partial date then decides to exit. Then get stuck with invalid date msg (doesn't even execute the lost focus!)
 
In order not to see the message, use SET NOTIFY OFF somewhere, but that does not prevent the fact that the user is stuck in the box until he deal with it, but selecting the erronous date and deleting it would allow the user to continue. On the other hand using the format set to "D" (no quotes) instead of set the value to {} would permit the user to enter any dates, even impossible ones without triggering an error, and using the valid to check the actual validity of the date. But I take it you do not have a date textbox class where you would only need to change once.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks Mike - actually a lot of the dates are a class so I will try changing to format D instead of value {}
 
This problem is usually solved with a special Date class.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top