Calculate Age then Count

  • Thread starter Thread starter msnews.microsoft.com
  • Start date Start date
M

msnews.microsoft.com

I am trying to calculate peoples age in a query and then count how many of a
certain age are in the table.
I have attempted

Field [DOB]
Criteria <Date()-65

to calculate the age, but I get nowhere. Where is my logic flawed?
 
Hi
Your expression should look something like this...

Maurice


SELECT Count(Customers.CustDate) AS CountOfCustDate
FROM Customers
HAVING (((Count(Customers.CustDate))<Date()-65));
 
When you set the criteria to Date()-65, the criteria is taken as 65days
before the current date and not 65 years before the current date.

You may try this.

Build an expression in your query, =(Datediff("y", [DOB], Date())/365
Then set the criteria under the expression to be >65, so that you can get
the particulars of all people more than 65 years old.

Eechhutti R.Rajasekaran
(e-mail address removed)


StCyrM said:
Hi
Your expression should look something like this...

Maurice


SELECT Count(Customers.CustDate) AS CountOfCustDate
FROM Customers
HAVING (((Count(Customers.CustDate))<Date()-65));


I am trying to calculate peoples age in a query and then count how many of a
certain age are in the table.
I have attempted

Field [DOB]
Criteria <Date()-65

to calculate the age, but I get nowhere. Where is my logic flawed?
 
Back
Top