Birthday Card

G

Guest

Our company send birthday cards to previous customers regularly. We send them by the unit of a week, for example, we will send on this Friday the cards to customers whose birthdays are due in the next week. Without splitting Date field into Date/Month/Year, is there any efficient way in ACCESS to do it? I know there should be ways of doing it, but not good enough to make one up. Thanks!
 
D

Douglas J. Steele

Assuming you've got their birthdate stored in a field dtmDOB, the following
WHERE clause will retrieve those customers having a birthday within the next
week:

WHERE DateDiff("d", Date(), DateSerial(Year(Date), Month(dtmDOB),
Day(dtmDOB))) < 7

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Gene Sun said:
Our company send birthday cards to previous customers regularly. We send
them by the unit of a week, for example, we will send on this Friday the
cards to customers whose birthdays are due in the next week. Without
splitting Date field into Date/Month/Year, is there any efficient way in
ACCESS to do it? I know there should be ways of doing it, but not good
enough to make one up. Thanks!
 
G

Guest

Hi Doug

Thank you for your reply. I did not expect there was such a wonderful place to find professional help (and get it without paying). (Actually, under certain circumstances, I would be very much willing to pay a lot to get the problem fixed!)

As to your reply, could you explain what is "year(date)", which seems not working. By the way, is there any place I can find the explanation for every function stored in Access

Gene
 
D

Duane Hookom

Actually, I think Doug forgot the () after "date". When writing code, the
()s are necessary and if you type them in, they are removed.

WHERE DateDiff("d", Date(), DateSerial(Year(Date()), Month(dtmDOB),
Day(dtmDOB))) < 7

To get help on functions, you can open any module and then press F1 and
search Help. Otherwise books like Access 2003 Inside Out by John Viescas
often have complete function references. John has his on the CD that
accompanies the book.

--
Duane Hookom
MS Access MVP


Gene Sun said:
Hi Doug,

Thank you for your reply. I did not expect there was such a wonderful
place to find professional help (and get it without paying). (Actually,
under certain circumstances, I would be very much willing to pay a lot to
get the problem fixed!)
As to your reply, could you explain what is "year(date)", which seems not
working. By the way, is there any place I can find the explanation for every
function stored in Access?
 
D

Douglas J. Steele

Thanks, Duane. I've got to remember to cut-and-paste examples, rather than
just topping them off the top of my head!

Of course, it's also possible that Gene's using the word Date somewhere in
his application: a control on a form, a variable, a table field, or
something else, and that's causing a conflict (since Date is a reserved
word), or that his References are messed up.

Gene: Post back if you're still having problems.
 

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