Formatting a Time field and Totalling time

yuccakid

New member
Local time
Today, 06:26
Joined
Apr 28, 2000
Messages
9
I have a form with a subform. In the subform the client enters an activity then the time (hour?-maybe), minutes and seconds) to perform the activity. The times entered are accumulated (on another form) for the day. The daily total of the time field is then used to calculate a total pay for the client.
1. How can I format a Date/Time field to allow entry of each individual work time (this could be minutes/seconds or maybe hour/minutes/seconds).
2. What expression can I use to sum the time fields for a given day (this will obviously be less than 24 hours) and what expression can I use to sum the accumulated time totals for a given month?

Desperate!
 
1. The input mask on the Date/time field would be ”09:00:00;0;_”

2 Then if you wanted to display the sum, then the format “hh\.nn\.ss” would be used. Of course this will only make sense if the total is always less than 24hrs.

3.The totals for a given month is gonna be a little harder. You’ll have to use the DateDiff() function. First sum all the records for a give month then us DateDiff() to get number of Hours, Minutes and Seconds.

HoursX= DateDiff("h",0,[SumOftimeX])
MinutesX= DateDiff("n",0,[SumOftimeX])
SecondsX= DateDiff("s",0,[SumOftimeX])

MinutesX= MinutesX - HoursX* 60
SecondsX= SecondsX –HoursX*60*60–MinutesX*60


Now just display the HourX, MinutesX and SecondsX in three separate Fields
 

Users who are viewing this thread

Back
Top Bottom