davidjwest
davidjwest

Reputation: 546

Access SELECT Where Field More than X Days ago

This query appears to be returning ALL rows and not just those more than 3 days old (ie the date in Created On field)

SELECT * FROM Master WHERE [Created On] < (Date()-3);

I don't see what is wrong with it.

EDIT - this worked as expected (sorry my question was badly worded)

SELECT * FROM Master WHERE [Created On] > (Date()-3);

Just changed the < to > ie all records that are more recent than 3 days ago.

Upvotes: 0

Views: 1519

Answers (1)

Pelais
Pelais

Reputation: 1737

I reproduced your SELECT command and it's apparently correct. In my case the query worked perfect. Try to execute this select to see the result of the (Date() -3) from three days ago. For example:

SELECT Date(), Date() -3, *
FROM Master
WHERE [Created On]<(Date()-3);

Follow the link with more information about Date() function for MS-Access: https://support.office.com/en-us/article/Examples-of-using-dates-as-criteria-in-Access-queries-aea83b3b-46eb-43dd-8689-5fc961f21762

Upvotes: 1

Related Questions