dateadd question

  • Thread starter Thread starter ryan.fitzpatrick3
  • Start date Start date
R

ryan.fitzpatrick3

If I want to go back 1 year from now and get everything from 1 year
ago until now or 6/24/07 to 6/24/08 is this correct? If so it's not
bringing back any information.


DateAdd("m",-12,Date())
 
On Tue, 24 Jun 2008 16:09:14 -0700 (PDT),
If I want to go back 1 year from now and get everything from 1 year
ago until now or 6/24/07 to 6/24/08 is this correct? If so it's not
bringing back any information.

DateAdd("m",-12,Date())

No, it's not correct. It will only return records of exactly that
date, 6/24/2007, and then only if the time value of that field is
Midnight.

You must supply the fill range of Start and End dates.
How does Access know you wish to return records from then to today if
you don't tell it.

Between DateAdd("yyyy",-1,Date()) and Date()

If the DateField includes a Time value, then use:

Between DateAdd("yyyy",-1,Date()) and DateAdd("d",1,Date())

While you can use DateAdd("m"-12,Date()) to subtract 12 months from
the current data, isn't just subtracting 1 year more intuitive.
In either case you still need to use the full Between .. And.. syntax.
 
Back
Top