473,669 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sorting short dates, without using years

Hi, I am a beginner working on a database to manage clients, payroll,
station assignments, etc. I have created a query which calculates age
based on subtracting the date of birth from the current date. This
works fine and date of birth is entered as month, day, year in
standard short date format (99/99/0000;;).

Here is the problem, I would also like to print out a list of all
clients who have a birthday in any given month. Presently, when I
attempt to sort the list, it takes the whole date into account and
uses the year as well. Therefore, a person born in November of 1945
will be listed before a person born in January 1975. Is there a way to
sort by month and date only without entering a new variable for date
of birth? Can you ask Access to sort a short date without using the
year? Thank you in advance.

Kgatchell2001
Nov 13 '05 #1
1 2507
On 24 Jun 2004 13:56:24 -0700, kgatchell2001 wrote:
Hi, I am a beginner working on a database to manage clients, payroll,
station assignments, etc. I have created a query which calculates age
based on subtracting the date of birth from the current date. This
works fine and date of birth is entered as month, day, year in
standard short date format (99/99/0000;;).

Here is the problem, I would also like to print out a list of all
clients who have a birthday in any given month. Presently, when I
attempt to sort the list, it takes the whole date into account and
uses the year as well. Therefore, a person born in November of 1945
will be listed before a person born in January 1975. Is there a way to
sort by month and date only without entering a new variable for date
of birth? Can you ask Access to sort a short date without using the
year? Thank you in advance.

Kgatchell2001


In the query, add another column:
SortColumn:Form at([DateOfBirth],"mm dd")
You can uncheck the Show check box as you don't need to display this
column.
Sort by this column.

Note... You haven't stated what expression you are using to calculate
age, but subtracting the date of birth from the current date may not
be accurate when computing the difference in years, i.e. someone born
on 12/31/2003 will be shown to be 1 year old on 1/1/2004.

Here is an expression you can use which is accurate.
Age: DateDiff("yyyy" , [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

Hope this helps.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3255
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) CType(local4, Short) = CType(src, Short)
22
4137
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b) { return -1; } else
18
5739
by: Scott | last post by:
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are not in chronological order. Is there a way to first sort the collection and put the dates in chronological order before creating the value list string? Or, how would I iterate over the collection pulling out the dates in chronological order? ...
2
5215
by: edwin van rutten | last post by:
Hi I have a personal database of all adresses etceteras of personal contacts and want to sort the birthday dates in such a way that I have a chronological list for this years birthdays. The problem I now encounter is that the system takes the years into account. I already was thinking of exporting to outlook to get this done, but I think there must be a smarter way
25
2212
by: Dan Stromberg | last post by:
Hi folks. Python appears to have a good sort method, but when sorting array elements that are very large, and hence have very expensive compares, is there some sort of already-available sort function that will merge like elements into a chain, so that they won't have to be recompared as many times? Thanks!
3
1361
by: CDMAPoster | last post by:
A.K.A. Is Double Dating a bad thing :-)? My post from several hours ago may have gotten lost so please forgive me if something similar to this shows up twice. From a modular programming class I took many years ago I was taught that it is important to maintain a good interface to hidden code so that when updates are created they can be tested and swapped into place without the program having to know the details of the hidden code. The...
10
2771
by: Sjaakie | last post by:
Hi, I'm, what it turns out to be, fooling around with 3-tier design. At several websites people get really enthusiastic about using custom dataobjects instead of datasets/-tables. While trying to write such layers myself I got stuck on how to get filtered or sorted data from the data-layer. This is what I got: Objects
0
1315
by: daverskully | last post by:
I REALLY REALLY appreciate any help that anyone can offer. I have a table called Data with the following fields: 1) ID 2) ReportDate 3) Department 4) DepartmentNumber 5) AccountExecutive 6) 7 yes/no fields
6
4068
by: =?Utf-8?B?RGFu?= | last post by:
I am reposting a question from about 3 weeks ago ("sorting capability"). I have an aspx page in which I get the data from a database dynamically, through C# code, by creating a dynamic table using TableHeaderCell and TableHeaderRow. The data is binded to the table by using a DataSet and Data Reader. The responses on the forum made me think that it would be easier to sort the data in the table (when clicking on the header column), by...
0
8462
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
8893
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...
0
8802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8658
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
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
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
2
1787
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.