calc date of birth in query

A

a

I have query contain 2 fields date of birth and today date and on calculated
field name calcdateofbirth
I want to know the the date of birth of any body by year and month
i can use this expression to calc the date of birth by year only like this
expression:
calcdateofbirth: DateDiff("yyyy";[dateofbirth];[todaydate])
I want to calcdateofbith by year and month in query
thank you
 
M

Marshall Barton

a said:
I have query contain 2 fields date of birth and today date and on calculated
field name calcdateofbirth
I want to know the the date of birth of any body by year and month
i can use this expression to calc the date of birth by year only like this
expression:
calcdateofbirth: DateDiff("yyyy";[dateofbirth];[todaydate])
I want to calcdateofbith by year and month in query


will this help?

http://www.mvps.org/access/datetime/date0001.htm
 
G

Guest

This would do it for you.

SELECT cdclt.CLDOB,
DateDiff("yyyy",[CLDOB],Date())+IIf(Month(Date())<Month([CLDOB]),-1,IIf(Month(Date())=Month([CLDOB]) And Day(Date())<Day([CLDOB]),-1,0)) AS Age
FROM cdclt;
 

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