Dates Queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to set up a birthdate query where Access would pull up anyone
whose age is 70 years old or above?
 
Sure. Add a new column to your query to calculate age...
PersonAge:
DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(
),"mmdd"))



Then in the criteria put...


Hope that helps.


Rick B
 
That second line should all be placed in the "Field:" of your query....

PersonAge: DateDiff("...





Rick B

Rick B said:
Sure. Add a new column to your query to calculate age...
PersonAge:
DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(
),"mmdd"))



Then in the criteria put...


Hope that helps.


Rick B


Sue said:
Is there a way to set up a birthdate query where Access would pull up anyone
whose age is 70 years old or above?
 
Far better would be to figure out 70 years prior to today, and check for
birthdays prior to that.

WHERE [Birthdate] <= DateAdd("yyyy", -70, Date())

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Rick B said:
Sure. Add a new column to your query to calculate age...
PersonAge:
DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(
),"mmdd"))



Then in the criteria put...


Hope that helps.


Rick B


Sue said:
Is there a way to set up a birthdate query where Access would pull up anyone
whose age is 70 years old or above?
 
Sue said:
Is there a way to set up a birthdate query where Access would pull up anyone
whose age is 70 years old or above?

Sue,

SELECT *
FROM YourTable AS Y1
WHERE Y1.Birthdate <
DateSerial((Year(Date()) - 70), Month(Date()), Day(Date()))


Sincerely,

Chris O.
 
Back
Top