You can modify the code I gave into an expression and use as a controlsource. You can use the same function to calculate age but it has to be in the form's module as you need to validate the DateofDeath.
Code:
Function CalcAge(DOB As Date) As String
'
'
End Function
For testing purpose, add a textbox to your form say txtDate. Set it's controlsource to IIf(IsDate(DateOfDeath),DateOfDeath,Date). Once this is displaying the correct date, set the age controls source to show age as =CalcAge([txtDate]). If it is working correctly, change the controlsource to =CalcAge(IIf(IsDate(DateOfDeath),DateOfDeath,Date) ).
If you need to call this function from other forms/reports, you have to put it into a module with a slight modification. The function will need two dates to calculate age.
Code:
Public Function CalcAge(DOB As Date, FinalDate as Date) As String
'
'
intMonths = DateDiff("m", DOB, FinalDate)
intDays = DateDiff("d", DateAdd("m", intMonths, DOB), FinalDate)
If intDays < 0 Then
intMonths = intMonths - 1
intDays = DateDiff("d", DateAdd("m", intMonths, DOB), FinalDate)
End If
'
'
End Function
Then the expression have to be changed to have both the date fields.
Post back if you have any difficulties. Further, do follow June's advice