473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

age calculations

1
I want to calculate the age in years, months and in days in Access. I have one field for years, one field for months and one field for days. If I enter a date of mortality, it must calculate the age in years, months and days.

Example: DOB is 12-Nov-2000 and Mortality date is 20-Nov-2007 the age must be 7 years, 0 months and 8days.

I tried the following and I got a problem in the days calculation. How can I get the exact age in days?

Age in years;
Int(DateDiff("y", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}')/365.25) - working fine

Age in months;
Int(DateDiff("m", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}') MOD 12) - working fine

Age in days;
Int(DateDiff("y", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}') MOD 30) - does not satisfy the age in days.
Nov 21 '07 #1
1 1525
JustJim
407 Expert 256MB
I want to calculate the age in years, months and in days in Access. I have one field for years, one field for months and one field for days. If I enter a date of mortality, it must calculate the age in years, months and days.

Example: DOB is 12-Nov-2000 and Mortality date is 20-Nov-2007 the age must be 7 years, 0 months and 8days.

I tried the following and I got a problem in the days calculation. How can I get the exact age in days?

Age in years;
Int(DateDiff("y", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}')/365.25) - working fine

Age in months;
Int(DateDiff("m", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}') MOD 12) - working fine

Age in days;
Int(DateDiff("y", '{Demographics.Date_of_Birth}', '{Event_Mortality.EventDate}') MOD 30) - does not satisfy the age in days.
Try this one here
Jim
Nov 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
0
by: Rowan | last post by:
Howdy, I am having some trouble figuring out the best way to approach my problem with calculations. I think I should use a view but am having trouble with the structure. My view needs to...
4
by: Targa | last post by:
Trying to total some price fields in a form but doesnt work when all the referenced form fields dont exisit. This is for an invoice - pulled prom a database and the form doesnt always contain the...
11
by: lduperval | last post by:
Hi, I`m trying to do date calculations in three types of time zones: local, GMT and specified. The issue I am facing is that I need to be able to specify a date in the proper time zone, and I`m...
3
by: brian kaufmann | last post by:
Hi, I had sent this earlier, and would appreciate any suggestions on this. I need to make calculations for unemployment rate for three different data sources (A,B,C) for many countries and age...
3
by: John M | last post by:
Hi, I've been coming up against a failure of a report to display the result of a simple calculation. I have realised that this calculation cannot take place unless the field I am working on is...
0
by: SJM | last post by:
There is a database which has combo boxes to allow users to select values from pre-set lists of common specifications. The form allows users to enter values that are not in the dropdown lists....
13
by: fredrik.ryde | last post by:
Hi, I have a database which contains alot of finacial data. I want to retreive some data, run som calculations with it, nothing complex just simple arithmetic. I wonder if it's faster to let...
1
by: Grubsy4u | last post by:
Grubsy4u Newbie 7 Posts October 5th, 2007 11:31 AM #1 Report calculations --------------------------------------------------------------------------------
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.