How do I set up a 7 day advance notice for a birthday in Access?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Microsoft Access 2002:
I need to create an expression that can calculate the number of days, based
on a birth date field, to the next birhtday and for every year after that.
I would also like the result to notify me that the birthday is due in 7 days.
 
Check the DateDiff function


mark said:
Microsoft Access 2002:
I need to create an expression that can calculate the number of days, based
on a birth date field, to the next birhtday and for every year after that.
I would also like the result to notify me that the birthday is due in 7
days.
 
I have experimented with DatDiff to no avail. Is there someone who would post
the expression string so that I can use it?
Thank you
Mark
 
Mark,

If you want the difference between two dates, use DateDiff. If you want to
add or subtract a given number of days, use DateAdd.

For example:

Dim date1 As variant
Dim date2 As variant
date1 = #2/22/2005#
date2 = DateAdd("d", -7, date1)
DateDiff("d", date1, date2)

The DateAdd will calculate date2 = #2/15/2005#
The DateDiff will give the difference as -7

If you want to determine the date that is 7 days before the birthdate, use
the DateAdd. If you want to determine if a certain date (e.g., today) is 7
days before the birthdate, then use the DateDiff.
 
Thanks JP! Very helpful!

JP said:
Mark,

If you want the difference between two dates, use DateDiff. If you want to
add or subtract a given number of days, use DateAdd.

For example:

Dim date1 As variant
Dim date2 As variant
date1 = #2/22/2005#
date2 = DateAdd("d", -7, date1)
DateDiff("d", date1, date2)

The DateAdd will calculate date2 = #2/15/2005#
The DateDiff will give the difference as -7

If you want to determine the date that is 7 days before the birthdate, use
the DateAdd. If you want to determine if a certain date (e.g., today) is 7
days before the birthdate, then use the DateDiff.
 
Back
Top