Birthday Access query

P

Plukje

I have a table called "Clientdata" and a field called "Birthdate". Every
day I'd like to run a query that shows my clients whose birthday it is.
How can I run this query?
 
L

Liz

Add the fields you want included to the design grid of
your Select Query.
Under the Birthdate field put =DATE() in the criteria row.
This will give you today's birthdays.
(You need to have the Birthdate field set as DATE/TIME in
the underlying table.)
Good Luck!
 
J

John Vinson

Add the fields you want included to the design grid of
your Select Query.
Under the Birthdate field put =DATE() in the criteria row.
This will give you today's birthdays.

Ummm... no. It won't. It will return the people who were born today,
this year only.

Instead, put in a calculated field:

Birthday: DateSerial(Year(Date()), Month([DOB]), Day([DOB]))

where DOB is the date of birth. This will calculate *this year's*
anniversary as a Date/Time value.

You may also want to use a criterion of

BETWEEN Date() AND Date() + 7

to see the coming week's birthdays, just to catch weekends and the
like.
 
S

Steve Schapel

Plukje,

If you want people born in previous years, you need to extract the day
and month from the Birthdate. Make a calculated field in the query
like this...
Birthday: Format([Birthdate],"ddmm")
and in the criteria, you can put...
Format(Date(),"ddmm")
I think this will work for all except the 29 Feb people.

- Steve Schapel, Microsoft Access MVP
 
L

Liz

Uh-oh! What was I thinking when I wrote that reply?
My apologies, and thanks, guys, for putting it right!

Time to go home!
-----Original Message-----
Add the fields you want included to the design grid of
your Select Query.
Under the Birthdate field put =DATE() in the criteria row.
This will give you today's birthdays.

Ummm... no. It won't. It will return the people who were born today,
this year only.

Instead, put in a calculated field:

Birthday: DateSerial(Year(Date()), Month([DOB]), Day ([DOB]))

where DOB is the date of birth. This will calculate *this year's*
anniversary as a Date/Time value.

You may also want to use a criterion of

BETWEEN Date() AND Date() + 7

to see the coming week's birthdays, just to catch weekends and the
like.


.
 

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