need an example of a DateAdd expression that adds years to a date

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

Guest

I am looking for examples where someone has used an expression to calculate
using the DateAdd function where they want to add a certain number of years
to a given date.
 
Hi Carl,

Simple one...

dateadd("yyyy", intNumYearsToAdd, dteDateToAddItTo)

Replacing the intNumYearsToAdd and dteDateToAddItTo with your own
variables/fields.

Damian.
 
I am looking for examples where someone has used an expression to calculate
using the DateAdd function where they want to add a certain number of years
to a given date.

See VBA help on the DateAdd function!!!!!!
To add 5 years to a date:
=DateAdd("yyyy",5,[ADateField])

To subtract 5 years from a date:
=DateAdd("yyyy",-5,[ADateField])
 
Carl said:
I am looking for examples where someone has used an expression to calculate
using the DateAdd function where they want to add a certain number of years
to a given date.

Customers who have made and order within the last n years e.g. n=11:

SELECT DISTINCT CustomerID
FROM Orders
WHERE OrderDate BETWEEN DATEADD('yyyy', -11, DATE()) AND DATE();

Jamie.

--
 
Back
Top