Age Calculations

  • Thread starter Thread starter John Whitney
  • Start date Start date
J

John Whitney

RYATES,

Here's something you could try...

Begin by adding this function to a module:

Public Function GetAge(DateofBirth As Date) As String
Dim dblTotalDays As Double, dblRemainderDays As Double
Dim intTotalYears As Integer
dblTotalDays = DateDiff("y", CDate(CStr(DateofBirth)
& " 12:00 AM"), Now())
intTotalYears = Int(dblTotalDays / 365)
dblRemainderDays = dblTotalDays - (intTotalYears *
365)
GetAge = intTotalYears & " Years " & dblRemainderDays
& " Days"
End Function

Add a new UNBOUND texbox to your report. The control
source of this field should be:
=GetDate([DateOfBirth])

In this example, I am referencing a field called
[DateofBirth]. Replace this field with the field in your
database which stores the person's Birth Date.

Hope this helps,
John Whitney
 
Back
Top