Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

calcualting age issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BUCKPEACE - 09 Nov 2005 15:41 GMT
I have been on this site and have read and reread and tired all the queries I
have seen to calculate the age.....None are working and I just need some
help.  I knwo this question has been asked and I am sorry I am replicating,
but someone please help me.  

Trying to calculate the age from a DOB    (ie   7/16/1978 = 27)

how simple I am sure this is and none of the FAQ queries worked....
I created a new filed called age, added the statement in the new field, and
nothing but 0 came up.   the filed with the date of birth is "patient date of
birth"

I need help.....Probably mental, but...........
Denis Dougall - 09 Nov 2005 16:03 GMT
Post your sql and let us see what you are doing.

Denis

> I have been on this site and have read and reread and tired all the queries I
> have seen to calculate the age.....None are working and I just need some
[quoted text clipped - 9 lines]
>
> I need help.....Probably mental, but...........
Ofer - 09 Nov 2005 16:10 GMT
Did you try the DateDiff function?

DateDiff("yyyy",[Fieldname],Date())

And See thiis link:

   http://www.mvps.org/access/datetime/date0001.htm
   Date/Time: Calculate Age of a person

Signature

The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck

> I have been on this site and have read and reread and tired all the queries I
> have seen to calculate the age.....None are working and I just need some
[quoted text clipped - 9 lines]
>
> I need help.....Probably mental, but...........
Duane Hookom - 09 Nov 2005 17:07 GMT
The DateDiff() function by itself will not work. DateDiff() simply counts
the number of date interval "boundaries" that are crossed between two date
values. For instance
DateDiff("yyyy",#12/31/2005#, #1/1/2006#) = 1
DateDiff("yyyy",#1/1/2005#, #12/31/2006#) = 1

DateDiff("d",#12/31/2005#, #1/1/2006#) = 1
DateDiff("D",#1/1/2005#, #12/31/2006#) = 729

In the above examples, difference in days varies from 1 to 729 but the
difference in years is 1.

The code/expressions at www.mvps.org/access will always work if used
correctly.

Signature

Duane Hookom
MS Access MVP
--

> Did you try the DateDiff function?
>
[quoted text clipped - 22 lines]
>>
>> I need help.....Probably mental, but...........
Rick B - 09 Nov 2005 17:01 GMT
The preferred formula for calculating age is...

DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(),"mmdd"))

Signature

Rick B

>I have been on this site and have read and reread and tired all the queries
>I
[quoted text clipped - 13 lines]
>
> I need help.....Probably mental, but...........
fredg - 09 Nov 2005 17:13 GMT
> I have been on this site and have read and reread and tired all the queries I
> have seen to calculate the age.....None are working and I just need some
[quoted text clipped - 9 lines]
>
> I need help.....Probably mental, but...........

To accurately compute a persons age, use.....
In a query:
Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

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

Change [DOB] to whatever the actual name of the date of birth field
is.

This Age computation should NOT be stored in any table.
Just compute it and display it on a form or report, as needed.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.