calculate age from DOB

G

Guest

Please post the exact calculation for DOB "Date of Birth" in the unbound box,
so if will show years, months, and days of age from DOB to next Birthday.
 
D

Douglas J. Steele

You can use the function in
http://www.accessmvp.com/DJSteele/Diff2Dates.html

Copy everything between Code Start and Code End and paste it into a new
module (not a class module nor a module associated with a form or report).
Do not name the module Diff2Dates when you save it: modules cannot have the
same name as functions contained within them.

Set the ControlSource for your text box to

=Diff2Dates("ymd", [DOB], Date())

(replace [DOB] with the actual name of your date of birth field)

(I assume you're trying to get the current age in years, months and days.
"years, months, and days of age from DOB to next Birthday" doesn't make
sense: months and days will always be 0 on the person's birthday!)
 

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

Top