In a Query you can resolve an age using a query similar to this:
SELECT [Name], [BDAY], DateDiff("yyyy",[bday],Date())-IIf(CDate(Month([bday]) & "/" & Day([bday]))>Date(),1,0) AS [Curr Age]
FROM tblBirthday;
Notice that I have added code to subtract 1 year if the Birthday has not happened yet this year, using the IIF statement.
or you can create a public function and use it in the query:
'Code for a module
Public Function YearsOld(ByVal dBDAY As Variant) As Integer
dBDAY = CDate(dBDAY)
YearsOld = DateDiff("yyyy", dBDAY, Date)
If CDate(Month(dBDAY) & "/" & Day(dBDAY)) > Date Then
YearsOld = YearsOld - 1
End If
End Function
'Query to be used with code:
SELECT [Name], [BDAY], YearsOld([bday]) AS [Curr Age]
FROM tblBirthday;