A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

sum the calculated time for each group



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2005, 01:44 PM
Dee
external usenet poster
 
Posts: n/a
Default sum the calculated time for each group

I'm having a problem totaling the total hours of worked in my report please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return to 0:00
on my report. The total column I created from query.
Thank
  #2  
Old April 22nd, 2005, 02:28 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return to
0:00
on my report. The total column I created from query.
Thank



  #3  
Old April 22nd, 2005, 04:39 PM
Dee
external usenet poster
 
Posts: n/a
Default

Thank you very much, but the result turn 00 when I instate "h" to "n", and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count more
than 12, look like if the total is 26 hours it will take away 12 hours and 12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return to
0:00
on my report. The total column I created from query.
Thank




  #4  
Old April 22nd, 2005, 04:59 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the query.
Once you have it working there, it will be very easy to sum that and display
it on the report.

We have no idea what is in your HoursAndMinutes() function.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to "n", and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count more
than 12, look like if the total is 26 hours it will take away 12 hours and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return to
0:00
on my report. The total column I created from query.
Thank



  #5  
Old April 22nd, 2005, 08:13 PM
Dee
external usenet poster
 
Posts: n/a
Default

Hi,
yes, they are in Date/Time type fields, and I did it work on query, it turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the query.
Once you have it working there, it will be very easy to sum that and display
it on the report.

We have no idea what is in your HoursAndMinutes() function.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to "n", and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count more
than 12, look like if the total is 26 hours it will take away 12 hours and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return to
0:00
on my report. The total column I created from query.
Thank




  #6  
Old April 23rd, 2005, 01:37 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Try the expressions on the web page in the Control Source of the text box on
your report.

They start with "=".

If they still error, then make sure the Name of this text box is not the
same as the name of one of your fields. For example the calculated text box
cannot be named Start_Time or End_Time.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
Hi,
yes, they are in Date/Time type fields, and I did it work on query, it
turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the query.
Once you have it working there, it will be very easy to sum that and
display
it on the report.

We have no idea what is in your HoursAndMinutes() function.


"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to "n",
and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count
more
than 12, look like if the total is 26 hours it will take away 12 hours
and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return
to
0:00
on my report. The total column I created from query.
Thank



  #7  
Old April 25th, 2005, 12:57 PM
DeeNg
external usenet poster
 
Posts: n/a
Default

Good morning Allen,
Thank you a million time for you help. It works, but the minutes turn to
negative if it greater than 190 minutes. I appreciate you value time.
DeeNguyen

"Allen Browne" wrote:

Try the expressions on the web page in the Control Source of the text box on
your report.

They start with "=".

If they still error, then make sure the Name of this text box is not the
same as the name of one of your fields. For example the calculated text box
cannot be named Start_Time or End_Time.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
Hi,
yes, they are in Date/Time type fields, and I did it work on query, it
turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the query.
Once you have it working there, it will be very easy to sum that and
display
it on the report.

We have no idea what is in your HoursAndMinutes() function.


"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to "n",
and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count
more
than 12, look like if the total is 26 hours it will take away 12 hours
and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return
to
0:00
on my report. The total column I created from query.
Thank




  #8  
Old April 25th, 2005, 12:57 PM
DeeNguyen
external usenet poster
 
Posts: n/a
Default

Good morning Allen,
Thank you a million time for you help. It works, but the minutes turn to
negative if it greater than 190 minutes. I appreciate you value time.
DeeNguyen

"Allen Browne" wrote:

Try the expressions on the web page in the Control Source of the text box on
your report.

They start with "=".

If they still error, then make sure the Name of this text box is not the
same as the name of one of your fields. For example the calculated text box
cannot be named Start_Time or End_Time.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dee" wrote in message
...
Hi,
yes, they are in Date/Time type fields, and I did it work on query, it
turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the query.
Once you have it working there, it will be very easy to sum that and
display
it on the report.

We have no idea what is in your HoursAndMinutes() function.


"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to "n",
and
another it give me the diff total. Actually I have a function name call
HoursAndMinutes, the total just take off every 12 hours when it count
more
than 12, look like if the total is 26 hours it will take away 12 hours
and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it return
to
0:00
on my report. The total column I created from query.
Thank




  #9  
Old April 25th, 2005, 03:24 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

The minutes should only be negative if an event ends before it starts.

If you are doing that to indicate an event the ends on the next day (e.g.
starts 11pm and ends 1am the next day), you could add 1440 minutes to
compensate for the change of date. Something like this:

=IIf(DateDiff("n", [StartDateTime], [EndDateTime]) 0, DateDiff("n",
[StartDateTime], [EndDateTime]) + 1440,
DateDiff("n", [StartDateTime], [EndDateTime]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DeeNguyen" wrote in message
...
Good morning Allen,
Thank you a million time for you help. It works, but the minutes turn to
negative if it greater than 190 minutes. I appreciate you value time.
DeeNguyen

"Allen Browne" wrote:

Try the expressions on the web page in the Control Source of the text box
on
your report.

They start with "=".

If they still error, then make sure the Name of this text box is not the
same as the name of one of your fields. For example the calculated text
box
cannot be named Start_Time or End_Time.


"Dee" wrote in message
...
Hi,
yes, they are in Date/Time type fields, and I did it work on query, it
turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the
query.
Once you have it working there, it will be very easy to sum that and
display
it on the report.

We have no idea what is in your HoursAndMinutes() function.


"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to
"n",
and
another it give me the diff total. Actually I have a function name
call
HoursAndMinutes, the total just take off every 12 hours when it
count
more
than 12, look like if the total is 26 hours it will take away 12
hours
and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as
zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my
report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it
return
to
0:00
on my report. The total column I created from query.
Thank



  #10  
Old April 25th, 2005, 04:49 PM
DeeNg
external usenet poster
 
Posts: n/a
Default

Thank you for respond, it works very well, and....I am having about an avege,
I have total cases column, and total time column, which fomula +[Minutes]
example
Cases Total
aaa .10
bbb 030
=Count(*) =[Minutes]...
and I don't know about fomula to put it in.
I appreciate you help.
Dee


"Allen Browne" wrote:

The minutes should only be negative if an event ends before it starts.

If you are doing that to indicate an event the ends on the next day (e.g.
starts 11pm and ends 1am the next day), you could add 1440 minutes to
compensate for the change of date. Something like this:

=IIf(DateDiff("n", [StartDateTime], [EndDateTime]) 0, DateDiff("n",
[StartDateTime], [EndDateTime]) + 1440,
DateDiff("n", [StartDateTime], [EndDateTime]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"DeeNguyen" wrote in message
...
Good morning Allen,
Thank you a million time for you help. It works, but the minutes turn to
negative if it greater than 190 minutes. I appreciate you value time.
DeeNguyen

"Allen Browne" wrote:

Try the expressions on the web page in the Control Source of the text box
on
your report.

They start with "=".

If they still error, then make sure the Name of this text box is not the
same as the name of one of your fields. For example the calculated text
box
cannot be named Start_Time or End_Time.


"Dee" wrote in message
...
Hi,
yes, they are in Date/Time type fields, and I did it work on query, it
turn
to minutes, and the report based on that query when I enter the
formula=Minutes.... the result is Errors. I appreciate your help.
Thank

"Allen Browne" wrote:

Are Start_Time and End_Time fields in a table?
Are they Date/Time type fields?

Try the link: it explains how to calculate the difference in the
query.
Once you have it working there, it will be very easy to sum that and
display
it on the report.

We have no idea what is in your HoursAndMinutes() function.


"Dee" wrote in message
...
Thank you very much, but the result turn 00 when I instate "h" to
"n",
and
another it give me the diff total. Actually I have a function name
call
HoursAndMinutes, the total just take off every 12 hours when it
count
more
than 12, look like if the total is 26 hours it will take away 12
hours
and
12
hours until it = 2hours, if less than 12 it ok
1:00
2:00
1:00
Iam ok but
8:00
8:00
9:00
the result is 1:00 and my expression is
=HoursAndMinutes(Sum([End_Time])-([Start_Time]))
Thank again for your time.

"Allen Browne" wrote:

DateDiff("h"...) gives you whole hours only, so 0:59 counts as
zero.

Try working in minutes:
=Sum(DateDiff("n", [Start_Time], [End_Time]))

If you need to see that as hours and minutes:
=Str(Sum(DateDiff("n", [Start_Time], [End_Time])) \ 60) &
Format(Sum(DateDiff("n", [Start_Time], [End_Time])) Mod 60, "\:00")

Explanation of how that works:
http://allenbrowne.com/casu-13.html


"Dee" wrote in message
...
I'm having a problem totaling the total hours of worked in my
report
please
if you know i would appreciate your help.
my total column such as
0:15
1:20
0:30
____
and my sytax is=Sum(DateDiff("h",Start_Time,End_Time)) and it
return
to
0:00
on my report. The total column I created from query.
Thank




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please Help! Ref Article ID 210504 Telobamipada New Users 8 May 9th, 2005 01:09 PM
Calendar Question Josh General Discussion 7 March 28th, 2005 11:19 PM
ambiguous outer joins renwick Running & Setting Up Queries 3 February 22nd, 2005 01:29 PM
Use first record found in expression? CASJAS Running & Setting Up Queries 17 July 22nd, 2004 09:21 PM
Outlook 2003 Terminal Server Time Zone issue Robert Strom Calendar 2 May 26th, 2004 10:50 PM


All times are GMT +1. The time now is 07:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.