query calculates the age

you can also Change your fnAge() function to handle Null:
Code:
Function fnAge(dtmBD As Variant, Optional dtmDate As Date = 1) _
As Variant
    ' Calculate a person's age, given the person's birth date and
    ' an optional "current" date.
    If IsNull(dtmBD) Or Not (IsDate(dtmBD)) Then
        Exit Function
    End If
    If dtmDate = 1 Then
        ' Did the caller pass in a date? If not, use
        ' the current date.
        dtmDate = Date
    End If
    fnAge = DateDiff("yyyy", dtmBD, dtmDate) + _
     (dtmDate < DateSerial(Year(dtmDate), Month(dtmBD), _
      Day(dtmBD)))
End Function
Thank you very much my dear friend
 

Users who are viewing this thread

Back
Top Bottom