Share via

Comparing a date from one field to today

Anonymous
2023-12-28T20:34:07+00:00

I have a field that has an order date (order_date) and I want to see if today's date is more than 21 days from the order date. We want to make a report that shows all orders that are 21 days old so we can call the customer with an update. Do I add the calculation in a query criteria? I did create a query.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2023-12-29T17:00:46+00:00

PS: Should you ever have occasion to something like this in a 'totals' query you should select 'where' in the 'total:' row.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

11 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-12-28T22:39:47+00:00

    21 days or more

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-12-28T21:44:26+00:00

    .... WHERE DateDiff("d", Date(), order_date) = 21 will work only on the exact day (if order_date contains a time portion, only at the exact same time within a few milliseconds). To get records at OR LATER than the same order date you need to use

    .... WHERE DateDiff("d", Date(), order_date) >= 21

    Was this answer helpful?

    0 comments No comments
  3. George Hepworth 22,855 Reputation points Volunteer Moderator
    2023-12-28T20:59:10+00:00

    Do you want ONLY records where the difference is exactly 21 days?

    Or would you include records where the difference is 21 days or more?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-12-28T20:52:40+00:00

    Your criteria will be:

    .... WHERE DateDiff("d", Date(), order_date) = 21

    Was this answer helpful?

    0 comments No comments