Change the field type to Double as Integer cannot hold decimals.
However, you should not update a table as the age will change daily.
Use a simple select query, and no update is needed:
Select *, TotalYears([ChildDoB], Date()) As Age
From tblChild
Here, a function is used:
' Returns the decimal count of years between Date1 and Date2.
'
' Rounds by default to three decimals, as more decimals has no meaning
' because of the leap years.
' Optionally, don't round, by setting Round3 to False.
'
' 2017-01-24. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function TotalYears( _
ByVal Date1 As Date, _
ByVal Date2 As Date, _
Optional Round3 As Boolean = True) _
As Double
Dim Years As Double
Dim Part1 As Double
Dim Part2 As Double
Dim Fraction As Double
Dim Result As Double
Years = DateDiff("yyyy", Date1, Date2)
Part1 = (DatePart("y", Date1) - 1) / DaysInYear(Date1)
Part2 = (DatePart("y", Date2) - 1) / DaysInYear(Date2)
If Round3 = True Then
' Round to three decimals.
Fraction = (-Part1 + Part2) * 1000
Result = Years + Int(Fraction + 0.5) / 1000
Else
Result = Years - Part1 + Part2
End If
TotalYears = Result
End Function
' Returns the count of days of the year of Date1.
'
' 2016-02-14. Gustav Brock, Cactus Data ApS, CPH.
'
Public Function DaysInYear( _
ByVal Date1 As Date) _
As Integer
Dim Days As Integer
Days = DatePart("y", DateSerial(Year(Date1), 12, 31))
DaysInYear = Days
End Function