A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Display Calculated Fields and Save Data on Form



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2008, 04:38 PM posted to microsoft.public.access.forms
lmgraham0629
external usenet poster
 
Posts: 3
Default 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  
Old April 29th, 2008, 04:53 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default 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  
Old May 5th, 2008, 04:44 PM posted to microsoft.public.access.forms
lmgraham0629
external usenet poster
 
Posts: 3
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.