Return Birthdates regardless of year

  • Thread starter Thread starter Torie
  • Start date Start date
T

Torie

Hi,

I have birthdates that are stored in a Date/Time field in
the following format "1967-12-29".

I want to be able to create a query where I can return all
the birthdates that took place between Dec 12th to Dec
30th in the database. I do not care about the year, just
the date range.

How would I go about creating such a query?
 
For this specific problem, you might try a query whose SQL looks something
like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
Month([Your Table].[Birthdate]) = 12
AND
(Day([Your Table].[Birthdate]) Between 12 And 30)

For a more the more general problem where the start and end dates may be in
different months and may be affected by leap years, you might use a slightly
different approach.
 
Torie

Brian's already provided a solution specific to your post. I'll just point
out that an Access Date/Time field stores a number ... how you format it to
display (e.g., "1967-12-29") is totally irrelevant when it comes to
querying.

Good luck

Jeff Boyce
<Access MVP>
 
Many thanks! Your suggestion has actually helped me out a
lot and I already have an idea on how I will customize it
further. Thank-you.

-----Original Message-----
For this specific problem, you might try a query whose SQL looks something
like this:

SELECT
[Your Table].*
FROM
[Your Table]
WHERE
Month([Your Table].[Birthdate]) = 12
AND
(Day([Your Table].[Birthdate]) Between 12 And 30)

For a more the more general problem where the start and end dates may be in
different months and may be affected by leap years, you might use a slightly
different approach.

Hi,

I have birthdates that are stored in a Date/Time field in
the following format "1967-12-29".

I want to be able to create a query where I can return all
the birthdates that took place between Dec 12th to Dec
30th in the database. I do not care about the year, just
the date range.

How would I go about creating such a query?


.
 
Back
Top