HondaKillrsx
HondaKillrsx

Reputation: 349

Can't get MS Access to show "Totals"

forgive me if I use the wrong terminology here as I am new to Access. I am trying to show just a single field and row that shows the average amount of days between to dates. For example, I have two fields that are pulled from a table called CheckInDate and CheckOutDate, I need to do a DateDiff on these two fields and then average all of these days and display just that single average when the query is ran. What I have so far is below:

I created an Expression field when the query is ran to get the amount of days by using:

          total: DateDiff('d',[CheckInDate],[CheckOutDate])

My confusion is what to do next to just show the average of this new "total" field and nothing else. I stipulate "nothing else" because I know how to add a "Totals" field at the end of the query but I am just looking to show a single field with just this average, which I am told you would use the "Totals" in the Query Tools ribbon but I can't change this from "Expression" or else it throws an error. I hope this makes sense.

Upvotes: 0

Views: 135

Answers (1)

Wayne G. Dunn
Wayne G. Dunn

Reputation: 4312

Try the following:

SELECT Avg(DateDiff('d',[CheckInDate],[CheckOutDate])) AS total
FROM Applicants;

Upvotes: 1

Related Questions