Dates Queries

S

Sue

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

Rick B

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
 
R

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?
 
C

Chris2

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.
 
Top