• 'works out the age of the apprentice.

    Dim total As String

    Dim strDOB As String = Format(CDate(.DateOfBirth), "MM dd")

    Dim todaysdate As String = Format(CDate(Date.Today), "MM dd")

    If strDOB > todaysdate Then

    strDOB = Format(CDate(.DateOfBirth), "yyyy") ''''''''''''''''''''''Hasn't had birthday yet this year

    todaysdate = Format(CDate(Date.Today), "yyyy")

    total = todaysdate - strDOB - 1

    Else

    strDOB = Format(CDate(.DateOfBirth), "yyyy") ''''''''''''''''''''''Has had birthday this year

    todaysdate = Format(CDate(Date.Today), "yyyy")

    total = todaysdate - strDOB

    End If

    p1_txtAge.Value = total

    p1_txtAge.Flatten = True

    this is something i wrote in VB.NET

    don't know if its any more accurate when working out the leap year issue