Specific Age Query for a Date Range

  • Thread starter Thread starter B. Levien
  • Start date Start date
B

B. Levien

Table = Personal
Field = Birthdate

I need to create a query to show who is of a certain age for January 1, 2008
to December 31, 2008.

For example, I need to know who will be 50, 60, 65, 70 and 75.

I would like to create the query so that when I click the query to open it,
I have to input the age.

I've done other queries to show who is of a specific age as of today:
AgeYears:
DateDiff("yyyy",[Birthdate],Date())-IFF(Format([Birthdate],"mmdd")>Format(Date(),"mmdd",1,0),
with criteria of [Age in Years] ... but I cannot figure out how to pull a
report saying who will be 50 this year, or 60 or 65, for the entire year
beginning January 1.

Can anyone please point me in the right direction?
 
I'm not sure your question makes sense. Unless the person's birthday is
January 1st, they're not going to have the same age for the entire year!

If what you're trying to do is get a list of everyone who'll be, say, 50
during the year, you can simply look at the year of birth. If it's 50 less
than the current year, you've found them.
 
If they will turn a specific age this year, you don't need to calculate the
month. The following expression will return the number of years between the
birthday year and the current year. The person will turn that age sometime
during the year. The filter for the year values you want:

Calculate
AgeYears: Year(Date) - Year([Birthdate])

Filter for years
Where Year(Date) - Year([Birthdate]) IN(50, 60, 65, 70, 75)
 
Klatuu, that is EXACTLY what I was looking for!!!! Thank you very much!!!!

Klatuu said:
If they will turn a specific age this year, you don't need to calculate the
month. The following expression will return the number of years between the
birthday year and the current year. The person will turn that age sometime
during the year. The filter for the year values you want:

Calculate
AgeYears: Year(Date) - Year([Birthdate])

Filter for years
Where Year(Date) - Year([Birthdate]) IN(50, 60, 65, 70, 75)
--
Dave Hargis, Microsoft Access MVP


B. Levien said:
Table = Personal
Field = Birthdate

I need to create a query to show who is of a certain age for January 1, 2008
to December 31, 2008.

For example, I need to know who will be 50, 60, 65, 70 and 75.

I would like to create the query so that when I click the query to open it,
I have to input the age.

I've done other queries to show who is of a specific age as of today:
AgeYears:
DateDiff("yyyy",[Birthdate],Date())-IFF(Format([Birthdate],"mmdd")>Format(Date(),"mmdd",1,0),
with criteria of [Age in Years] ... but I cannot figure out how to pull a
report saying who will be 50 this year, or 60 or 65, for the entire year
beginning January 1.

Can anyone please point me in the right direction?
 
Back
Top