I’ve got a column stored as the date/time data type upon which I wan’t to calculate age in years. I’m using the DateDiff function in Access 2007.
SELECT Visits.ID, Visits.DOB, DateDiff("y",[DOB],[date]) AS age
FROM Visits;
As an aside to this question, I tried to use [date] to select the current date whenever the query is ran, but it just gave me a prompt to type in the date, it didn’t grab it automatically.
DOB is the date of birth for each record.
Specify “yyyy” for the interval argument, instead of “y”. “yyyy” is the year, “y” is the day of year.