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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

time sums



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2004, 07:51 PM
microsoft
external usenet poster
 
Posts: n/a
Default time sums

im trying to set a format of a text box so i can count the number of hours
an employee works i can get it to calculate the differance between 2 times
but if the total goes above 24 hour i get an #error.

can access count time in excess of 24 hours?


thanks in advance for your help


john


  #2  
Old May 31st, 2004, 08:02 PM
Ken Snell
external usenet poster
 
Posts: n/a
Default time sums

Yes, but if you're trying to use a "short time" or other format, you'll get
an error if the time that you want to display is more than 24 hours (after
all, there are only twenty-four hours in a day).

Please provide more details about your setup.
--
- - - - - - - - - - - - - - - - -
Ken Snell
MS ACCESS MVP

"microsoft" wrote in message
...
im trying to set a format of a text box so i can count the number of hours
an employee works i can get it to calculate the differance between 2 times
but if the total goes above 24 hour i get an #error.

can access count time in excess of 24 hours?


thanks in advance for your help


john




  #3  
Old May 31st, 2004, 08:57 PM
microsoft
external usenet poster
 
Posts: n/a
Default time sums

ive got 6 fields shiftID date, start time, finish time, dlyhrs and tothrs

all of wich are controls on a form (dlthrs and tothrs are unbound) dlyhrs
calculates the diffrence between 2 times and tothrs is supposed to calculate
total hours worked over a week in the format hh:mm (if its possible)

thanks again
john

"Ken Snell" wrote in message
...
Yes, but if you're trying to use a "short time" or other format, you'll

get
an error if the time that you want to display is more than 24 hours (after
all, there are only twenty-four hours in a day).

Please provide more details about your setup.
--
- - - - - - - - - - - - - - - - -
Ken Snell
MS ACCESS MVP

"microsoft" wrote in message
...
im trying to set a format of a text box so i can count the number of

hours
an employee works i can get it to calculate the differance between 2

times
but if the total goes above 24 hour i get an #error.

can access count time in excess of 24 hours?


thanks in advance for your help


john






  #4  
Old June 2nd, 2004, 04:34 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default time sums

The "trick" to displaying hours and minutes that go beyond "23:59" is to
calculate the time differential in minutes, and then use the minutes to
calculate the full hours and the residual minutes, and then display them
using the Format command in the "hh:nn" format.

Assuming that a field named STime is the start time and ETime is the end
time, use this as the control source to display the time differential in
your desired format:

=Format(DateDiff("n", [STime], [ETime]) \ 60, "0:") & Format(DateDiff("n",
[STime], [ETime]) Mod 60, "00")

To get a weekly total, you'll need to sum the individual time differences
for each day, and then use an expression similar to this for the control
source of a textbox in the form's footer (assuming you have a continuous
forms view):

=Format(Sum(DateDiff("n", [STime], [ETime])) \ 60, "0:") &
Format(Sum(DateDiff("n", [STime], [ETime])) Mod 60, "00")

--
- - - - - - - - - - - - - - - - -
Ken Snell
MS ACCESS MVP

"microsoft" wrote in message
...
ive got 6 fields shiftID date, start time, finish time, dlyhrs and tothrs

all of wich are controls on a form (dlthrs and tothrs are unbound) dlyhrs
calculates the diffrence between 2 times and tothrs is supposed to

calculate
total hours worked over a week in the format hh:mm (if its possible)

thanks again
john

"Ken Snell" wrote in message
...
Yes, but if you're trying to use a "short time" or other format, you'll

get
an error if the time that you want to display is more than 24 hours

(after
all, there are only twenty-four hours in a day).

Please provide more details about your setup.
--
- - - - - - - - - - - - - - - - -
Ken Snell
MS ACCESS MVP

"microsoft" wrote in message
...
im trying to set a format of a text box so i can count the number of

hours
an employee works i can get it to calculate the differance between 2

times
but if the total goes above 24 hour i get an #error.

can access count time in excess of 24 hours?


thanks in advance for your help


john








  #5  
Old June 2nd, 2004, 04:42 AM
Graham R Seach
external usenet poster
 
Posts: n/a
Default time sums

Does this help?
http://www.pacificdb.com.au/MVP/Code/DiffTime.htm

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyT...764559036.html


"microsoft" wrote in message
...
im trying to set a format of a text box so i can count the number of hours
an employee works i can get it to calculate the differance between 2 times
but if the total goes above 24 hour i get an #error.

can access count time in excess of 24 hours?


thanks in advance for your help


john




 




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


All times are GMT +1. The time now is 02:19 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.