[AccessD] CheckDate?

Gustav Brock Gustav at cactus.dk
Fri Dec 3 05:37:50 CST 2004


Hi Borge

Well, the problem is that IsDate() and CDate() don't care for "likely
dates" only possible dates which date strings formatted as yy/mm/dd
certainly are.
If you need dates within a certain time frame, you'll have to check
that on your own as you already have done.

You could also, in the BeforeUpdate event, check for 

  Day(strDate) = Val(strDate)

or, for our US formatted friends:

  Month(strDate) = Val(strDate)

/gustav

>>> pcs at azizaz.com 03-12-2004 03:01:01 >>>
Hi, amazing how inexhaustible this subject is....

I have an unbound textcontrol formatted dd mmm yyyy or dd mmm yy

If I enter 32 Dec 2004 Access will cut in and tell me: Not a valid
entry
etc....

If I enter 32 Dec 04 - Access interprets as 4 Dec 1932

When I test for a valid date in the beforeupdate event using IsDate()
it
tests on the 4 Dec 1932 value ....

What am I doing wrong here?

Or rather : how do I catch obvious incorrect entries like 32 Dec 04
using
IsDate() before Access let them slip through?

Currently I test entry in text control box on the validation rule
property:
>=#1/01/2001#
Hmmmm....

Regards
Borge

----- Original Message ----- 
From: "S D" <accessd667 at yahoo.com>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Wednesday, November 03, 2004 5:39 PM
Subject: Re: [AccessD] CheckDate?

> Gustav Brock <gustav at cactus.dk> wrote:
> Hi Sander
>
> > However, I added some extra checks to rule out 'impossible dates'
> > like 29,30 or 31 februari, 31 november, etc.
>
> Well, that's the point - IsDate() checks that as well!
> Both IsDate("31-11-xxxx") and IsDate("11-31-xxxx") will fail.
>
> /gustav




More information about the AccessD mailing list