By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

Query of Customers with Date of Birth in Specific Range

P: 2
Afternoon all,

I've been battling with this all day today and my brain is now pretty much fried.

I have one table that lists several details about my customers (name, address, phone, date of birth etc).

I want to create a query that will allow me to enter a start date and an end date and will then display the customers who have birthdays within those two dates.

I know I can do this using:

Criteria BETWEEN Forms!NameOfForm!StartDate AND Forms!NameOfForm!EndDate

But it's a little more complex because a date of birth also includes a year. I'm not concerned with what year they were born. Just whether or not they have a birth day this year within a specific set of dates.

I guess I have the code correct, and this is more a question regarding table format. How can I query just the date and month and ignore the year of birth?

Thanks!

Jamie
Oct 31 '08 #1
Share this Question
Share on Google+
3 Replies


nico5038
Expert 2.5K+
P: 3,072
Try to use the Format() function to get the "MM/DD" part of the date to compare.
Also the Month() and Day() function could be used.

Nic;o)
Oct 31 '08 #2

P: 2
Thanks for the reply, Nic.

I'm really not sure how to do what you suggested. My knowledge of Access is quite basic (I got the code in my initial post from another thread that was listed on here).

Jamie
Oct 31 '08 #3

nico5038
Expert 2.5K+
P: 3,072
Try in your query to add a field like:

select format(DOB,"MDD") as YearMonth from tblPerson;

In the graphical query editor use:
YearMonth:format(DOB,"MDD")

Just replace DOB with your Birthdate fieldname.

Nic;o)
Oct 31 '08 #4

Post your reply

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