473,808 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find Age in a year, given the Birth Date

77 New Member
Hi,

I have a table named Admittance, it has fields, Case Number, Birth Date that stores all patients admitted till date starting many years earlier.
I need to find out the age (in years and months) of all patients in the year 2007.
The main aim is to find out if any one of them was 18 yrs old in 2007.
Hope I explained enough to understand the requirement.

Please help,

Thanks
Jan 18 '08 #1
3 3426
jaxjagfan
254 Recognized Expert Contributor
Hi,

I have a table named Admittance, it has fields, Case Number, Birth Date that stores all patients admitted till date starting many years earlier.
I need to find out the age (in years and months) of all patients in the year 2007.
The main aim is to find out if any one of them was 18 yrs old in 2007.
Hope I explained enough to understand the requirement.

Please help,

Thanks
Select Admittance.[Case Number],DateDiff("m",[Birth Date], 12/31/2007)/12 as Age From Admittance Where DateDiff("m",[Birth Date], 12/31/2007)/12 is Between 18.0 and 18.9999;

This would return Age in decimal values 18.5 would be 18 yrs 6 months
Jan 18 '08 #2
AccessHunter
77 New Member
Select Admittance.[Case Number],DateDiff("m",[Birth Date], 12/31/2007)/12 as Age From Admittance Where DateDiff("m",[Birth Date], 12/31/2007)/12 is Between 18.0 and 18.9999;

This would return Age in decimal values 18.5 would be 18 yrs 6 months

I tried your query, but for a Case number with Birth Date of 1/1/1918, its giving the Age as -18.083333 !!

Please help

Thanks
Jan 22 '08 #3
jaxjagfan
254 Recognized Expert Contributor
I tried your query, but for a Case number with Birth Date of 1/1/1918, its giving the Age as -18.083333 !!

Please help

Thanks
What is the actual format of the birth date column? Access read that record as 1/1/2018.
Jan 22 '08 #4

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

Similar topics

3
1892
by: dik mus | last post by:
Hi, I connect to a database that only stores the year and weeknumber. But i need the date of the corresponding monday. This could be more difficult as one expect because the weekumbers might change from country to country. (I am looking for a dutch solution.) Thanks, dik
3
5936
by: Matt | last post by:
Given a date, how to find the beginning date and ending date of that week please advise!
6
4842
by: Burghew | last post by:
Hello, I generate invoices for my customers evry month. I want to keep a form which will allow the user to select the Month and Year through a combo and thus generate reports based on the month selected. Also, please let me know how I can keep a copy of invoices which I generate for future reference. Awaiting eagerly for your replies -- 'With Thanks'
14
1534
by: Lyle Fairfield | last post by:
Year Numbers A recent post prompts me to point out a capability of JET 4.0, to set the seed and increment of identity columns. (This is not a solution for that post.) I create a Table named PurchaseOrders with an AutoNumber Field named ID. ----- I run this code:
1
1184
by: ibiza | last post by:
Hi all, I need to find a specific, for example the third friday of a given month/year. How to do that? thanks :)
2
1203
by: Matuag | last post by:
Hi All, I am trying to create a form which can calculate with Age and Birth Date fields. I want Age to be calculated based on Birth Date (which I managed to do) but at the same time if Birth Date is not available it should allow users to enter the age in the same field. Is this possible?
2
2175
by: Scott | last post by:
I have two fields in a query that hold dates. One is DOB, the other is HireDate. I want to add a field to a query that will take the employees DOB and based on their hire date, wil display their age in years and months at the time they were hired. I then need to add a query field to take the HireDate and TermDate (termination date) to show their length of tenure with the company. Thanks- Scott
4
2938
by: cjohns | last post by:
I am brand new to programing and am trying to write a C++ program that calculates how many days are left to a persons birthday. I need to make a function for the leap years, and to get number of days in a month, i have no idea how to do this. any help would be great.. i am using windows op, with visual studios 2005 this is what i have so far. #include <iostream> using namespace std; int getdate (int& day, int& month, int& year);
1
4821
by: karimufeed | last post by:
I am working on an access project for pension calculation. I want to generate the retirement date automatically at the age of 60 years while filling the date of Birth. i.e. if the Date of birth is 15/1/1950 then the date of retirement will be 31/1/2010 and if the date of birth is 01/1/1950 then the date of retirement will be 31/12/2009 one day earlier. Kindly help me how to generate the date of retirement by using VB code in an access project.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10628
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.