Display Calculated Fields and Save Data on Form

L

lmgraham0629

Hi, I know this question has been asked often but here goes.
I have the D.O.B. and need an accurate age to be calculated...and then
saved, if that's even possible. Ideally I would like to enter the birthdate,
have the calculated age displayed and saved for use later
we do statistics based on age of the patient on the date of the procedure.
So if given the birthdate...can I have Access calculate the age and store it,
and then later calculate success rates based on patients age ranges?
Thanks
Lindsey
 
F

fredg

Hi, I know this question has been asked often but here goes.
I have the D.O.B. and need an accurate age to be calculated...and then
saved, if that's even possible. Ideally I would like to enter the birthdate,
have the calculated age displayed and saved for use later
we do statistics based on age of the patient on the date of the procedure.
So if given the birthdate...can I have Access calculate the age and store it,
and then later calculate success rates based on patients age ranges?
Thanks
Lindsey

To calculate the age of a patient in easy enough.
No real need to save it (even though you think you do).

Let's assume you are storing the patients date of birth and the date
the procedure was done.

To calculate the age as of the date of procedure (which may or may
not be the current date), you can use:

In a query:
Age: DateDiff("yyyy", [DOB], [DateOfProcedure]) - IIF(Format([DOB],
"mmdd") Format([DateOfProcedure], "mmdd"), 1, 0)

Or directly as the control source of an unbound control in a report or
on a form:
=DateDiff("yyyy",[DOB],[DateOfProcedure])-IIf(Format([DOB],
"mmdd")>Format([DateOfProcedure],"mmdd"),1,0)

Just compute it and display it on a form or report, as
needed.
Change (DOB] and [DateOfProcedure] to whatever your actual date fields
are named.
 
L

lmgraham0629

Thanks a bunch! That will also enable me to pull out say pregnancy rates
based on how old the woman was at the time of the procedure?

fredg said:
Hi, I know this question has been asked often but here goes.
I have the D.O.B. and need an accurate age to be calculated...and then
saved, if that's even possible. Ideally I would like to enter the birthdate,
have the calculated age displayed and saved for use later
we do statistics based on age of the patient on the date of the procedure.
So if given the birthdate...can I have Access calculate the age and store it,
and then later calculate success rates based on patients age ranges?
Thanks
Lindsey

To calculate the age of a patient in easy enough.
No real need to save it (even though you think you do).

Let's assume you are storing the patients date of birth and the date
the procedure was done.

To calculate the age as of the date of procedure (which may or may
not be the current date), you can use:

In a query:
Age: DateDiff("yyyy", [DOB], [DateOfProcedure]) - IIF(Format([DOB],
"mmdd") Format([DateOfProcedure], "mmdd"), 1, 0)

Or directly as the control source of an unbound control in a report or
on a form:
=DateDiff("yyyy",[DOB],[DateOfProcedure])-IIf(Format([DOB],
"mmdd")>Format([DateOfProcedure],"mmdd"),1,0)

Just compute it and display it on a form or report, as
needed.
Change (DOB] and [DateOfProcedure] to whatever your actual date fields
are named.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top