Date to Age

M

Mary M

How can you convert a date dd/mm/yyyy to an age? ie. If a table has a
birthdate field I would like to just display the Age on a form and not the
date.

Many thanks in advance for any assistance.
 
G

Guest

=DateDiff("yyyy", [Insert Date of Birth], Now())+ Int( Format(now(), "mmdd")
< Format( [Insert Date of Birth], "mmdd") )
 
M

Mary M

Thanks,

How would I be able to put this on a form so that it will display the
calculated age for each record the value will change for each record?

Thanks again.l


Wayne-in-Manchester said:
=DateDiff("yyyy", [Insert Date of Birth], Now())+ Int( Format(now(),
"mmdd")
< Format( [Insert Date of Birth], "mmdd") )



Mary M said:
How can you convert a date dd/mm/yyyy to an age? ie. If a table has a
birthdate field I would like to just display the Age on a form and not
the
date.

Many thanks in advance for any assistance.
 
S

Steve Schapel

Mary,

You can put an unbound textbox on the Detail section of the form.
Assuming your BirthDate field is in the form's Record Source
table/query, you can use the expression given by Wayne in the Control
Source property of the textbox, and it should show the Age for each
record in the form. Well, something like Wayne's expression... I would
slightly simplify it, and debug it, like this...
Age:
DateDiff("yyyy",[BirthDate],Date())+(Format([BirthDate],"mmdd")>Format(Date(),"mmdd"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Display Age on Form 3
Age 9
Automatically update "Age" field 2
Calculating Age 8
Access 2000: Data Type Mismatch in query 2
Age Calculation 8
Negative values for age calculation 8
Calculating age problem 8

Top