[mso] Re: Access Age Calculation

  • From: "Ray Blake" <ray@xxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Fri, 15 Aug 2003 18:15:59 +0100

Glenda,

You're probably better off using the DATEDIF formula, and wrapping it in
a ROUND. This should do what you need. 

Round(DateDiff("y",[SPBPERS_BIRTH_DATE],Date())/365.2425-0.5,0)

Since ROUND will always round to the nearest integer, I subtract 0.5 at
the end which has the effect of the expression always rounding down,
which is what we tend to do with ages, of course. You could - if you
prefer - simply wrap such a ROUND function around your existing formula.

I've used 365.2425 because it's a closer approximation, and with a
centurial leap year just having passed, I have a notion that more
accuracy is better, although I haven't been bothered to prove it makes a
difference I'm afraid!

Ray
_____________

This email is from Ray Blake, Head of Software Design, GR Business
Process Solutions. It is confidential and intended for the addressee
only. The contents are private and may be legally privileged. If you
receive this email in error we would be grateful if you would advise the
sender and delete the email from your system.

For more information on the services that we offer please visit us at
our website: - www.grbps.com 


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Glenda Wells
Sent: 15 August 2003 17:57
To: mso@xxxxxxxxxxxxx
Subject: [mso] Access Age Calculation

Hi.
 
I'm trying to calculate age in Access using this formula
 
Age: (Date()-[SPBPERS_BIRTH_DATE])/365.25
 
This runs from a make-table query.
 
The table is formatted as Double with zero decimal places with the
intent of getting a whole number.
 
The result is 20.7583846680 instead of 20.
 
Please help. /g
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:

http://www.smartgroups.com/vault/msofiles
*************************************************************

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: