How do I sort a DateDiff result in an Access query?

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

Guest

I want to calculate age, and then sort by that age and/or select only a
certain age range for output in my query. To calculate age in a query, I am
using DateDiff("yyyy",[DateOfBirth],Now()). The resultant age is correct,
however, I am unable to enter criteria or sort without receiving a data
mismatch error. I've tried numeric, text, and date formats in the event I
set the type wrong somewhere. I've also tried using a query that calculated
age as input into another query in which I'd enter the criteria, but I still
receive the data mismatch error.
 
Are you sure your calculations are correct? If a person was born,
12/31/2004, your calc would have them at a year old. If the person was born,
1/1/2005, his/her age would always be the same as someone born 12/31/2005.

There are better calcs at http://www.mvps.org/access/datetime/date0001.htm.

What is the SQL view of a query that didn't work?
 
Back
Top