J
jon_russ
Guest
Hi guys,
I am still trying to make the DB for my sisters dance company.
I have managed to calculate the students ages from the DOB field, but I also need to know their ages at the 31 March and 1 December for competition purposes.
I am using the following code as a module:.....
Function Age(varBirthDate As Variant) As Integer
Dim varAge As Variant
If IsNull(varBirthDate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthDate, Now)
If DOB < DateSerial(Year(Now), Month(varBirthDate), _
Day(varBirthDate)) Then
varAge = varAge - 1
End If
Age = CInt(varAge)
End Function
.....to calculate the age.
The age field contains the following in the ControlSource property of the text box:
=Age([DOB]) & " yrs "
Please could you suggest a method that would allow meto calculate the ages as of 31 March & 1 Dec of the current year.
TIA
Jon
I am still trying to make the DB for my sisters dance company.
I have managed to calculate the students ages from the DOB field, but I also need to know their ages at the 31 March and 1 December for competition purposes.
I am using the following code as a module:.....
Function Age(varBirthDate As Variant) As Integer
Dim varAge As Variant
If IsNull(varBirthDate) Then Age = 0: Exit Function
varAge = DateDiff("yyyy", varBirthDate, Now)
If DOB < DateSerial(Year(Now), Month(varBirthDate), _
Day(varBirthDate)) Then
varAge = varAge - 1
End If
Age = CInt(varAge)
End Function
.....to calculate the age.
The age field contains the following in the ControlSource property of the text box:
=Age([DOB]) & " yrs "
Please could you suggest a method that would allow meto calculate the ages as of 31 March & 1 Dec of the current year.
TIA
Jon