Query: calc. age based on birth date

  • Thread starter Thread starter Jan
  • Start date Start date
J

Jan

I have two fields:
1. DOB (date of birth)
2. CreationDate

I would like an output table with 2 columens:
1. DOB
2. Age (Age = Creation Date - DOB)

Age is calculated as number of years. I'm using Access 2003 on XP, any
ideas on how such a calculation query is made?
 
Jan,

Basic calculation is

Age = DatePart("yyyy",CreationDate) - DatePart("yyyy",DOB)

but this needs adjusting if creation date is earlier in the year than date
of birth. So

If DatePart("y",CreationDate) < DatePart("y",DOB) then
Age=Age - 1
End If

Rod
 
Back
Top