Birthday Query - Find Birthdays for Today

G

Guest

I have a list of names and birthdays. I'd like to query for who's birthday
is today where the database automatically knows today's date - i.e. I don't
have to change the query date every day. Can I format the Date() function to
only look for day and month?
 
D

Douglas J. Steele

WHERE Format([DOB], "mmdd") = Format(Date(), "mmdd")

or

WHERE DateSerial(Year(Date()), Month([DOB]), Day([DOB]) = Date()
 
G

Guest

That first statement worked perfectly! Thank you so much for your help.

Douglas J. Steele said:
WHERE Format([DOB], "mmdd") = Format(Date(), "mmdd")

or

WHERE DateSerial(Year(Date()), Month([DOB]), Day([DOB]) = Date()

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


John E. said:
I have a list of names and birthdays. I'd like to query for who's birthday
is today where the database automatically knows today's date - i.e. I
don't
have to change the query date every day. Can I format the Date() function
to
only look for day and month?
 
G

Guest

I'd suggest one small amendment:

WHERE Format([DOB]+1, "mmdd") = Format(Date()+1, "mmdd")

That way you don't miss anyone with a birth date on 29 February. They'll be
picked up on 28 February in non leap years. Doug's second method would work
for them BTW, but would pick them up on 1 April in non leap years. I only
know one person with a birth date of 29 February and they celebrate it on 28
February in non leap years.

Ken Sheridan
Stafford, England

John E. said:
That first statement worked perfectly! Thank you so much for your help.

Douglas J. Steele said:
WHERE Format([DOB], "mmdd") = Format(Date(), "mmdd")

or

WHERE DateSerial(Year(Date()), Month([DOB]), Day([DOB]) = Date()

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


John E. said:
I have a list of names and birthdays. I'd like to query for who's birthday
is today where the database automatically knows today's date - i.e. I
don't
have to change the query date every day. Can I format the Date() function
to
only look for day and month?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top