calculating children's ages

G

Guest

I have seen the responses to the calculating ages questions and see that Tom
Lake's response to Todd does work. However, I need to produce the child's
age in years and months. The db is for a child care center where the more
exact age is needed. I do not want the age in months only because the user
then must manually divide to figure out the age of a child -- 49 months is 4
yrs/1 mos. Nor do I want to use a decimal approach because there are 12
months in a year. Must I use 2 fields and calculate separately? If so what
is the formula to show only the remainder months? I'd rather have one field
if possible.
 
S

Steve Schapel

Nancy,

If you are doing it in a query, make a calculated field like this:
Age: (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date())))\12 & " yrs
" & (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date()))) Mod 12 & " mos"

Same thing if you want it in the control source of a textbox on your
form or report, just put a = in front of the expression.
 
G

Guest

Many thanks -- will try it!
--
nhb -- nc


Steve Schapel said:
Nancy,

If you are doing it in a query, make a calculated field like this:
Age: (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date())))\12 & " yrs
" & (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date()))) Mod 12 & " mos"

Same thing if you want it in the control source of a textbox on your
form or report, just put a = in front of the expression.

--
Steve Schapel, Microsoft Access MVP

I have seen the responses to the calculating ages questions and see that Tom
Lake's response to Todd does work. However, I need to produce the child's
age in years and months. The db is for a child care center where the more
exact age is needed. I do not want the age in months only because the user
then must manually divide to figure out the age of a child -- 49 months is 4
yrs/1 mos. Nor do I want to use a decimal approach because there are 12
months in a year. Must I use 2 fields and calculate separately? If so what
is the formula to show only the remainder months? I'd rather have one field
if possible.
 
G

Guest

Worked like a charm!! Many thanks.
--
nhb -- nc


Steve Schapel said:
Nancy,

If you are doing it in a query, make a calculated field like this:
Age: (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date())))\12 & " yrs
" & (DateDiff("m",[DOB],Date())+(Day([DOB])>Day(Date()))) Mod 12 & " mos"

Same thing if you want it in the control source of a textbox on your
form or report, just put a = in front of the expression.

--
Steve Schapel, Microsoft Access MVP

I have seen the responses to the calculating ages questions and see that Tom
Lake's response to Todd does work. However, I need to produce the child's
age in years and months. The db is for a child care center where the more
exact age is needed. I do not want the age in months only because the user
then must manually divide to figure out the age of a child -- 49 months is 4
yrs/1 mos. Nor do I want to use a decimal approach because there are 12
months in a year. Must I use 2 fields and calculate separately? If so what
is the formula to show only the remainder months? I'd rather have one field
if possible.
 

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

Help calculating AGE!! 3
Current Date in Query 12
calculating age 1
calculate Age problem date notation european american format 2
DateDiff problem 2
year on year tracking 4
Average Age 4
Convert Age to Months 3

Top