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

Date Calculation question. 1

Status
Not open for further replies.

Tofias1

MIS
Jun 17, 2002
57
US
As always hello to anyone who takes a look at my question in advance.

Well here it is. I have a field named birthdate a field named Age and a text box set to date(). What I would like to know is it posible through useing VBA to check once BirthDate is > 70 years comparing it to datetext then display over 70 in age?

Or any other way would be more than greatly appreciated.

Thanks,
Tofias1
 
Set the datasource of your field to...

IIf(DateDiff("yyyy", birthdate, Date) > 70, "Over 70", "Under 70")
 
I have a similiar question to the age calculation below. I am calculating age by subtracting the date of birth from the current date. However, the calculation is rounding the difference and I need it to drop the fraction. Thanks for any replies
 
Pezamystik,

Thanks for the help. It worked great.

Tofias1
 
wwbryan,
I recently had a similar problem with calculating a person's age correctly and found that the following code worked just fine when used as the control source:

=Int(DateDiff("d",[DOB],Date()/365.25)

By using the Int function, the calculation drops the fractions and dividing by 365.25 takes care of leap years.

I hope this helps you.

Carolob CarolOB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top