calc date of birth in query

  • Thread starter Thread starter a
  • Start date Start date
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
 
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
 
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;
 
Back
Top