If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Display Calculated Fields and Save Data on Form
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 |
#2
|
|||
|
|||
Display Calculated Fields and Save Data on Form
On Tue, 29 Apr 2008 08:38:00 -0700, lmgraham0629 wrote:
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. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#3
|
|||
|
|||
Display Calculated Fields and Save Data on Form
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" wrote: On Tue, 29 Apr 2008 08:38:00 -0700, lmgraham0629 wrote: 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. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|