Hi Bob,
Here is a function for calculating a person's age.
Public Function age_calc_var(DateOfBirth As Variant, Optional dtmDate
As
Date =3D 0) As Variant
Dim intAge As Variant
If IsNull(DateOfBirth) Then
intAge =3D ""
Else
If dtmDate =3D 0 Then
' Did the caller pass in a date? If not, use the current
date.
dtmDate =3D Date
End If
intAge =3D datediff("yyyy", DateOfBirth, dtmDate)
If dtmDate < DateSerial(Year(dtmDate), Month(DateOfBirth),
Day(DateOfBirth)) Then
intAge =3D intAge - 1
End If
End If
age_calc_var =3D intAge
End Function
Usage: age =3D age_calc_var([Date_of_Birth]) gives age as of today.
age =3D age_calc_var([Date_of_Birth], #12/31/2002#) gives age as of
the end of the year.
Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: Bob Bohannon [mailto:bbohannon@r...]
Sent: Thursday, October 24, 2002 14:03
To: Access
Subject: [access] Access QBE
I have a access db that has a field called Date_of_birth. I would like
to
find the age of our clients and age by group of clients from a date
that
can be entered when I run a QBE.