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

automatically work out age

Status
Not open for further replies.

daveinuk

Technical User
Sep 2, 2005
72
0
0
DE
Hi all.

Im using access 2002 on windows XP.

I have a table which contains a Date of Birth in a date field.

I want to automatically work out the age of the person when I enter the Date of Birth in a form and have left a created a text field to tell me the age of the person.

How do I go about doing this?

Many thanks.
 
Hi
These should help:
How to calculate age (another method).
faq181-85
Age Calculation Function
faq181-3769
Online Resources & Help for Date/Time Functions in Access
faq705-3277

The last one has lots of links.
 
Age = DateDiff("yyyy", DOB, Date) + (Format(DOB, "mmdd") > Format(Date, "mmdd"))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
rats, wrong dbms :)

of course, that works

still, it is what i call a hack

not apparent at all upon cursory examination

this might be better --

Age = DateDiff("yyyy", DOB, Date)
+ iif(Format(DOB, "mmdd")
> Format(Date, "mmdd"), -1, 0)

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top