Help with a date function

  • Thread starter Thread starter Myriam
  • Start date Start date
M

Myriam

Hi, hope someone can help me.
I've been using a datediff function to get all dates <= 30
days of today.
DateDiff("d", date1, Date()) <=30.

This works fine but i don't want to see any dates greater
than todays date. for example if Date() = 16th Oct 03,
then dates such as 18th Oct 03 would still be returned
because it is <= 30 days.

I only want to see days which occured before today.

Any help would be great.
thanx.
 
Myriam

I may not be fully understanding what you want to do, but it seems like you
could "swap" the order of "date1" and "Date()" if you wanted the subtraction
to work the other way. I will point out that any negative DateDiff() result
is still "<=30"...

?Maybe you need to test for only positive (or negative) DateDiff's?

Good luck

Jeff Boyce
<Access MVP>
 
Myriam,

Or perhaps, you could change the criteria to

Between DateAdd("d", -30, Date()) And Date()
 
Back
Top