Need Help with date calculations!!!

  • Thread starter Thread starter anitra_tanner
  • Start date Start date
A

anitra_tanner

I have an orders table, I am tryin to write a query that will use the
Order Date (O_Date) for calculating orders with dates 7 days previous,
the date in the O_Date field.

In the criteria
I have used Date() -7 but I still get future dates in my results

I have also used DateAdd("d", 7, Date()) and DateAdd("d", -7, Date())
and many other versions of the 2. <,> etc...

I also need dates 1 month before and after today's date. Any
suggestions?
 
I have an orders table, I am tryin to write a query that will use the
Order Date (O_Date) for calculating orders with dates 7 days previous,
the date in the O_Date field.

In the criteria
I have used Date() -7 but I still get future dates in my results

BETWEEN Date() - 7 AND Date()

or

BETWEEN DateAdd("d", -7, Date()) AND Date()
I also need dates 1 month before and after today's date. Any
suggestions?

BETWEEN DateAdd("m", -1, Date()) AND DateAdd("m", 1, Date())

Note that if O_Date has time in it (because you used the Now() function to
populate it, rather than the Date() function), you'll want to increase the
end date in both cases:

BETWEEN Date() - 7 AND Date() + 1

and

BETWEEN DateAdd("m", -1, Date()) AND DateAdd("m", 1, Date()) + 1
 
Back
Top