C
Citipool
Hi there, I am using below code to calculate a contact age in my database. It
was working just fine yesterday. However, when I logged in today it's showing
an error inside the age txt box. Could someone please tell me what am I doing
wrong? Thanks alot.
'FUNCTION NAME: Age()
'
' PURPOSE:
' Calculates age in years from a specified date to today's date.
'
' INPUT PARAMETERS:
' varDateofBirth: a birth date.
'
' RETURN
' Age in years.
'
'*************************************************************
Function Age(varDateofBirth As Variant) As Integer
Dim varAge As Variant
If IsNull(varDateofBirth) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varDateofBirth, Now)
If Date < DateSerial(Year(Now), Month(varDateofBirth), _
Day(varDateofBirth)) Then
varAge = varAge - 1
End If
Age = CInt(varAge)
End Function***
was working just fine yesterday. However, when I logged in today it's showing
an error inside the age txt box. Could someone please tell me what am I doing
wrong? Thanks alot.
'FUNCTION NAME: Age()
'
' PURPOSE:
' Calculates age in years from a specified date to today's date.
'
' INPUT PARAMETERS:
' varDateofBirth: a birth date.
'
' RETURN
' Age in years.
'
'*************************************************************
Function Age(varDateofBirth As Variant) As Integer
Dim varAge As Variant
If IsNull(varDateofBirth) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varDateofBirth, Now)
If Date < DateSerial(Year(Now), Month(varDateofBirth), _
Day(varDateofBirth)) Then
varAge = varAge - 1
End If
Age = CInt(varAge)
End Function***