MS Access question

Hiroyuki Tamura
Hiroyuki Tamura used Ask the Experts™
on
do you know how to create calculate filed for how many days past?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
to calculate number of days passed between two dates, you can use the dateDiff() function

dateDiff("d", [startDate],[endDate])
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
The expression:

    DateAdd("d", -n, Date())

will give you the date of n days in the past.

If you need an interval in a query, you can use:

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

/gustav
Hiroyuki TamuraField Engineer

Author

Commented:
Screenshot.png
is this the right way?
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
No, that doesn't make sense.

You would use the expression in a query, not a table.
The source in the query would be a table with two fields: [Start Date] and [End Date]

/gustav

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial