Birthdays week, month, year?

  • Thread starter Thread starter Harmannus
  • Start date Start date
H

Harmannus

Hallo,

How do i make a query that shows all the people who have there birthday
(based on the field "DateOfBirth) in a given week (month or year)?

Tried some coding but i am stuck.

Thanx for any tips.


Regards,

Harmannus
 
I think you use wildcards * like in the where clause.

Where mydate like "12/*/03"

which should give you everything in december 03
(e-mail address removed)
 
I think week might be a little trickier than the other like statements. I would
look up week in the help file. Try a comparison is you know the week you are
looking for.
(e-mail address removed)
 
Harmannus,

All those with their birthdays in a given year...
SELECT * FROM YourTable ;-)

All those with their birthdays in a given month...
Suppose the user enters the MonthNumber required in an unbound textbox
on a form:
SELECT * FROM YourTable WHERE Month([DateOfBirth]) =
Forms!YourForm!MonthNumber

Week... well, it will be something similar, but how are you going to
designate which week?

- Steve Schapel, Microsoft Access MVP
 
Hallo,

How do i make a query that shows all the people who have there birthday
(based on the field "DateOfBirth) in a given week (month or year)?

The method I prefer is to put a calculated field in a Query:

HappyBirthday: DateSerial(Year(Date()), Month([DateOfBirth]),
Day([DateOfBirth]))

This will contain this year's birthday anniversary date; you can apply
criteria to it just as any other date field, such as

BETWEEN Date() AND DateAdd("m", 1, Date())

to see those birthdays coming up in the next month.
 
Back
Top