How do you get an actual age calculation in a query?

B

Bayou BoB

I just posted the following in the "forms" group, which I felt may
have been in error due to it really being a query based question...so
my apologies to followers of both groups, here is my question.

In my Client Query, I'd like to calculate exact age of the client...in
Years, and months. I'm wondering what expression I might use to do
this? It would be extremely beneficial to have the calculation to
display in a number of our forms and reports, and currently we are
using the following expression, which just gives us the actual age in
years alone, often leaving people to have to look back at the DOB to
count the months in their head:

=DateDiff("yyyy",[DateOfBirth],Date())+(Format([DateOfBirth],"mmdd")>Format(Date(),"mmdd"))

I'm wondering how that should be modified to give me a result of say
34.6, meaning 34 years, 6 months old. Many thanks!

Kevin
 
V

Van T. Dinh

(answered in microsoft.public.access)

Please do not multipost. If you think it is necessary, use cross-posting
(sending one post with up to 3 relevant newsgroup addresses on the post).
 
B

Bayou BoB

(answered in microsoft.public.access)

Please do not multipost. If you think it is necessary, use cross-posting
(sending one post with up to 3 relevant newsgroup addresses on the post).

Apologies. Hence why my opening line was an apology because I
originally thought it belonged in the Forms group, and posted only
there. Afterward I felt that in error, and posted here where I thought
it more appropriate.

K
 
G

Guest

Hi Kevin,

Try this:

= Int(DateDiff("m", [DateOfBirth]) / 12) & " Years " &
DateDiff("m", [DateOfBirth], Date) Mod 12 & " Months"

Tokash
 
A

Andy

Kevin;

This worked for me.

http://members.rogers.com/douglas.j.steele/Diff2Dates.html

Andy

Hi Kevin,

Try this:

= Int(DateDiff("m", [DateOfBirth]) / 12) & " Years " &
DateDiff("m", [DateOfBirth], Date) Mod 12 & " Months"

Tokash
-----Original Message-----
I just posted the following in the "forms" group, which I felt may
have been in error due to it really being a query based question...so
my apologies to followers of both groups, here is my question.

In my Client Query, I'd like to calculate exact age of the client...in
Years, and months. I'm wondering what expression I might use to do
this? It would be extremely beneficial to have the calculation to
display in a number of our forms and reports, and currently we are
using the following expression, which just gives us the actual age in
years alone, often leaving people to have to look back at the DOB to
count the months in their head:

=DateDiff("yyyy",[DateOfBirth],Date())+(Format ([DateOfBirth],"mmdd")>Format(Date(),"mmdd"))

I'm wondering how that should be modified to give me a result of say
34.6, meaning 34 years, 6 months old. Many thanks!

Kevin
.
 

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