Age at time of test date

LOgle0917

New member
Local time
Today, 10:00
Joined
Mar 2, 2007
Messages
4
I am trying to create a field that will calculate a persons age at the time of a test date. I have the DOB field that gives for example :

3/10/1993

Then I have a field that turns this into the Age in Year and months

14 yrs 0 mos

I have a TEST Date field that tells me when they took the test:

10/1/2001

Now I need a field that will calculate how old they were at the time they took the test. I tried using this formula:

AgeAtTest([DOB], [TestDate])

but then in my field I am getting this : #Name?

It should calculate them to be: 6 yrs old at the time of the test. How can I make this happen?

Thanks!
 
Is AgeAtTest() a user designed function? It's certainly not a standard function.
 
there has been a slew of post on calculating DOB today, search the forum.
 
I have my DOB Code calculated I need help in creating the Age a person was at the time they took a test: Here is the public function I am using but when the child has had a test say yesterday and they were 6 months old that is what should reflect as the age at test date but for some reason it is giving back 1yr 6 mos:

Public Function AgeAtTest(DOB As Date, TestDate As Date) As String

Dim Yrs As Integer
Dim Mths As Integer
Dim tAge As Double

Yrs = DateDiff("yyyy", DOB, TestDate)

tAge = (DateDiff("m", DOB, TestDate))

If (DatePart("d", DOB) > DatePart("d", TestDate)) Then
tAge = tAge - 1
End If

If tAge < 0 Then
tAge = tAge + 1
End If

Mths = CInt(tAge Mod 12)

AgeAtTest = Yrs & " Years " & Mths & " Months"

End Function

How can I rework this to give me an accurate age at test date?
 

Users who are viewing this thread

Back
Top Bottom