Help with a date function

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.
 
J

Jeff Boyce

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>
 
J

John Spencer (MVP)

Myriam,

Or perhaps, you could change the criteria to

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top