PDA

Click to See Complete Forum and Search --> : Simple date validation in a text box


Caro
Dec 6th, 1999, 08:08 PM
Somebody must have done this!! I need to check a date for validity (going to Access database) and must be entered in the format dd/mm/yy. Has anyone got the code for this? I hate re-inventing the wheel - as well as being lazy!

john_murphy
Dec 6th, 1999, 08:31 PM
What you want is the isdate function.....
Here is the help


ISDATE FUNCTION
Returns a Boolean value indicating whether an expression can be converted to a date.

Syntax

IsDate(expression)

The expression argument can be any date or string expression recognizable as a date or time.

Remarks

IsDate returns True if the expression is a date or can be converted to a valid date; otherwise, it returns False. In Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D.; the ranges vary among operating systems.


Example This example uses the IsDate function to determine if an expression can be converted to a date.

MyDate = "February 12, 1969": YourDate = #2/12/69#: NoDate = "Hello"
MyCheck = IsDate(MyDate) ' Returns True.
MyCheck = IsDate(YourDate) ' Returns True.
MyCheck = IsDate(NoDate) ' Returns False.