Calculating total hours

  • Thread starter Thread starter RJS76 via AccessMonster.com
  • Start date Start date
R

RJS76 via AccessMonster.com

Hi,

I have searched the KB and I have found some articles but I cannot seem to
work it out for my purposes. What I'm trying to do is that I want to sum the
total hours of our agents on the Servicedesk.

I have created a query which shows the following:

Agent Name SC - Date - Logged in
Agent X - 2 jan 06 - 08:00:00
Agent X - 3 jan 06 - 08:00:00
Agent X - 4 jan 06 - 08:00:00
Agent X - 5 jan 06 - 08:00:00

What I need is a query which now shows the following:

Agent Name SC - Logged in
Agent X - 32:00:00

Somehow I cannot get this to work. I have a basic knowledge of Access. Can
somebody please help me with this.

Thank you.
 
Your 3rd field - [Logged in] - is a Date/Time field where 08:00:00
represents 8 hours?

A date time/field is not really ideal for recording durations, but if you
are stuck with that structure, you could create a query that converts the
time to minutes so you can sum them. You will type something like this into
a fresh column in the Field row of your query:
Minutes: DateDiff("n", #0:0:0#, [Logged in])

You can then turn it into a Totals query, by depressing the Total button on
the toolbar (upper case sigma icon). Access adds a total row to the design
grid. Under the Agent name, accept Group By. Under your Minutes column,
choose Sum.

To show the sum as hours an minutes on a form or report, set the Control
Source of the text box to:
=[Minutes] \ 60 & Format([Minutes] Mod 60, "\:00")

For an explanation of why and how that works, see:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html
 
Thanks for your reply. I will try this. I will let you know.

Allen said:
Your 3rd field - [Logged in] - is a Date/Time field where 08:00:00
represents 8 hours?

A date time/field is not really ideal for recording durations, but if you
are stuck with that structure, you could create a query that converts the
time to minutes so you can sum them. You will type something like this into
a fresh column in the Field row of your query:
Minutes: DateDiff("n", #0:0:0#, [Logged in])

You can then turn it into a Totals query, by depressing the Total button on
the toolbar (upper case sigma icon). Access adds a total row to the design
grid. Under the Agent name, accept Group By. Under your Minutes column,
choose Sum.

To show the sum as hours an minutes on a form or report, set the Control
Source of the text box to:
=[Minutes] \ 60 & Format([Minutes] Mod 60, "\:00")

For an explanation of why and how that works, see:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html
I have searched the KB and I have found some articles but I cannot seem to
work it out for my purposes. What I'm trying to do is that I want to sum
[quoted text clipped - 16 lines]
Somehow I cannot get this to work. I have a basic knowledge of Access. Can
somebody please help me with this.
 
I have tried your formulas and it works perfectly! Thank you so much for your
help!


Allen said:
Your 3rd field - [Logged in] - is a Date/Time field where 08:00:00
represents 8 hours?

A date time/field is not really ideal for recording durations, but if you
are stuck with that structure, you could create a query that converts the
time to minutes so you can sum them. You will type something like this into
a fresh column in the Field row of your query:
Minutes: DateDiff("n", #0:0:0#, [Logged in])

You can then turn it into a Totals query, by depressing the Total button on
the toolbar (upper case sigma icon). Access adds a total row to the design
grid. Under the Agent name, accept Group By. Under your Minutes column,
choose Sum.

To show the sum as hours an minutes on a form or report, set the Control
Source of the text box to:
=[Minutes] \ 60 & Format([Minutes] Mod 60, "\:00")

For an explanation of why and how that works, see:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html
I have searched the KB and I have found some articles but I cannot seem to
work it out for my purposes. What I'm trying to do is that I want to sum
[quoted text clipped - 16 lines]
Somehow I cannot get this to work. I have a basic knowledge of Access. Can
somebody please help me with this.
 

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

Back
Top