Birthdays - D

  • Thread starter Thread starter Garry Stokes
  • Start date Start date
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
 
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>
 
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?
 
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")
 
In the criteria field type:

Between Date()and Date()+30

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

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

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