UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Birthday Query    
 
   
ashams
post May 11 2005, 01:07 AM
Post #1

New Member
Posts: 3



Please help me with a query.I have a table Members with feilds Name, Gender,DateofBirth .
I want to figure out which Members had birthdays that fell within a particular date range. The start date and end date will have values from the current year.
Go to the top of the page
 
+
Bemmy
post May 11 2005, 03:20 AM
Post #2

UtterAccess Addict
Posts: 185
From: Nottingham, England



You could have a form with 2 unbound text boxes - DateFrom and DateTo (short date format). In the criteria grid of your query for the DateOfBirth field put - Between [Forms].[YourFormName].[DateFrom] And [Forms].[YourFormName].[DateTo]
You will then be able to print the query results in a report or display them on a form (you will have to requery the form when you change the date values).

Hope this helps.
Go to the top of the page
 
+
ashams
post May 23 2005, 03:36 AM
Post #3

New Member
Posts: 3



Thanx for your response ,but this is not what i wanted.I have a similar form like u described .The start date and end date will be dates from the current year.But the date of brith can be from any year. For example, if I give the Fromdate as 5/Mar/2005 and ToDate as 11/May2005 the query should list all the people who celebrate their birthday in this range of date.I need to know how should i write the query to get the records.
Go to the top of the page
 
+
truittb
post May 23 2005, 07:57 AM
Post #4

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



Welcome to Utter Access.

Change the DOB to whatever you date of birth field is. The best way to pass the criteria to the query would be from a form. This is using hard coded dates. You can modify it as needed.

Where Month(DOB) = 3 and Day(DOB) Between 5 and 11
Go to the top of the page
 
+
ashams
post May 23 2005, 10:43 PM
Post #5

New Member
Posts: 3



Could you be a litte more elaoborate. With the SQl statemnet in your post it will return only people with birthday falls in 5th March and 11th March.What I needed is a complete queryto list al the members having birthday in the given date range.the dates can fall in 2 different years also,
The table structure is
Member
Name Text
DOB Date

I need to know how to write the SQL statement that is the Select statement to list all the people who have Birthday in the given range of dates. That's we are not considering the year part in DOB. only the day and month parts of DOB.
For eg. The dates can be 25/12/04 to 3/1/05 or 3/1/05 to 17/1/05 or 18/1/05 to 3/2/05 and similar dates.
these FromDate and ToDate can be parameters in the selct statement.
Go to the top of the page
 
+
truittb
post May 24 2005, 07:08 AM
Post #6

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



Just change the month to a between.

Where Month(DOB) Between 2 and 6 and Day(DOB) Between 1 and 12
Go to the top of the page
 
+
robandlorie
post May 25 2005, 02:47 AM
Post #7

UtterAccess Addict
Posts: 149
From: Indiana



I had a problem if the date range crossed into the next year so I wrote a small Function I think might work and give you what you want. I attached a sample DB with it in it. Maybe this will help get you started anyway.


Have a wonderful day (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 06:35 PM