Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query by months 1

Status
Not open for further replies.

needlotsofhelp

Technical User
Apr 4, 2002
7
0
0
US
I am a VERY new user. I have a database that contains our member's birthdates. The birthdate is stored in Medium date format (ddmmmyy). I would like to write a query that will allow me to type in a month or months and return all of the members with birthdays in that month. I have read many posts about the DATEPART function, but I am unable to figure it out. I did get it to work by entering the number of the month requested,(See code below wich was originally posted by Paul F.) but that only allows me to request one month at a time. Is it possible to edit the code below to ask for multiple months i.e. Jun - Jul? Jun -Sep? Thanks in advance for your help!

Month: DatePart("m",[Birthdate])

Then Cut and Paste this into the Criteria Row

Eval("InputBox(""Enter The number of the month for the birthdays you want to
display:"",""Need Month"",DatePart('M',Date()))")

 
My response to this would be to get the user to enter a beginning month and end month for the range of months to be listed (ie if you want april through june then the beg. month would be 4 and end would be 6). Then I'd do something like this in the criteria:

>=[beginning month] and <= [ending month]

-how you get the beginning month and ending month data is up to you, you can use something like you already have (the input box)...basically your datepart(&quot;m&quot;, [birthday]) is going to return one number, so you just need to compare it to other numbers in your query to get the correct set of data. Hope this helps...

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top