Date() function

petercummins

Registered User.
Local time
Today, 07:57
Joined
Sep 6, 2005
Messages
52
Hi Guys,

Does anybody know the formula for validating a date in a DOB field.

I want it to only allow dates where the age is at least 18years old.

Something like '<Date()-18' (But a formula that works!)

Thanks in advance!
 
Dateadd function is what you are looking for

Read the help on how it works....
 
petercummins said:
Hi Guys,

Does anybody know the formula for validating a date in a DOB field.

I want it to only allow dates where the age is at least 18years old.

Something like '<Date()-18' (But a formula that works!)

Thanks in advance!

try something like this.

Dim age as int

age = DateDiff("yyyy",Now(),[DOB Field Name])

Then use the age variable to do your calculations for your validation.
 
Searched yet? Try "Calculate Age." See if it returns less than a hundred threads.
 
petercummins said:
Thanks people. I have it working now

Can you please post how you did it so others can learn from you in the future.
 
<DateAdd('yyyy',-18,Date())

This subtracts 18years off the system date. I used this as the Date of Birth on the entry form had to be valid to 18years old or older.
 
petercummins said:
<DateAdd('yyyy',-18,Date())

This subtracts 18years off the system date. I used this as the Date of Birth on the entry form had to be valid to 18years old or older.

Thank you,

I apparently was going about it the hard way. Well, I have a tendacy of doing that. :eek:

Good job for figuring it out on your own. :D
 

Users who are viewing this thread

Back
Top Bottom