Ages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I work out ages in years and months from an "DateofBirth" field in a
access database report?
This is the first time i have tried to calculate this so would like some
guidance please.
Regards
Denis
 
Ron
Copied in the function, changing the DOB for DateofBirth field I have in my
batabase but it came up with an error highlighting "Then". Can you advise?
Regards
Denis
 
How are you calling the function. As Written it was designed to be called
with two parameters the Start Date (BornOnDate) and the End Date (typically
today's Date). So when I call it like this:

? getagestr("1/30/47",date)

from the Immediate Window it prints

58y-10m
Which is my current age.

Exactly how are you attempting to use this function?
 
Ron
The database is for employees with a field "DateofBirh" completed dd/mm/yyyy
and I am trying to work out their ages in months yy and mm. This is due to
age requirements for some positions that are need to be filled.

Regards
Denis
 
If you have a text box on your report that you want to hold the Age in Years
and months then set the controlSource of that text box to:
=getagestr([DateOfBirth],Date).
This assumes that you have a column in the RecordSource of the report whose
name is DateOfBirth, and that column is a DateTime data type.

If the RecordSource column DateOfBirth is a Text data type, then set your
textbox ControlSource to:
=getagestr(Format([DateOfBirth],"mm,dd,yyy"),Date).
 
Oooopppssss...

Typo on the format string should be
=getagestr(Format([DateOfBirth],"mm,dd,yyyy"),Date).

Sorry!!
--
Ron W
www.WorksRite.com
Ron Weiner said:
If you have a text box on your report that you want to hold the Age in Years
and months then set the controlSource of that text box to:
=getagestr([DateOfBirth],Date).
This assumes that you have a column in the RecordSource of the report whose
name is DateOfBirth, and that column is a DateTime data type.

If the RecordSource column DateOfBirth is a Text data type, then set your
textbox ControlSource to:
=getagestr(Format([DateOfBirth],"mm,dd,yyy"),Date).

--
Ron W
www.WorksRite.com
Denis said:
Ron
The database is for employees with a field "DateofBirh" completed dd/mm/yyyy
and I am trying to work out their ages in months yy and mm. This is due to
age requirements for some positions that are need to be filled.

Regards
Denis
have
 
Back
Top