Birthdays - D

G

Garry Stokes

I have a field DOB (date of birth) and i want to create a
query or report that will tell who has a birthday in the
next 30 days.

any ideas
 
J

Jeff Boyce

Garry

So, conceptually, you want to know if a person's day & month of birth in
THIS year is less than 31 days from the current date?

Take a look at the DateSerial() function, and use it something like:

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

to get a person's day & month of birth THIS year.

Then look at the DateDiff() function to subtract that DateSerial() value
from Date() (the function that returns today's date). You'll probably also
need to use the absolute value function (Abs()), to ensure that you catch
birthdays both before and after Date().

Good luck!

Jeff Boyce
<Access MVP>
 
G

garry

i'm real new to this? where do i need to put this
function?

I have a DOB column do i need to run a report or query or
open an new field for this?
 
V

Van T. Dinh

There are a few different criteria you can set but you can try an SQL String
like:

SELECT *
FROM tblPerson
WHERE Format([DOB],"mmdd")
Between Format(Date(),"mmdd")
And Format(DateAdd("m",1,Date()),"mmdd")
 
M

Melinda

In the criteria field type:

Between Date()and Date()+30

This will return dates between today and the next 30 days.
 
J

Jeff Boyce

Melinda

Wouldn't that only return DOBs in the current year?

Jeff Boyce
<Access MVP>
 
V

Van T. Dinh

Actually, the criteria should return no Records as no one has been born
between Date() and Date() + 30 yet anyway. <g>
 

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