PDA

View Full Version : Solved: Job Time Problem



sooty8
11-13-2008, 01:21 PM
Hi All

Having a problem with a UserForm working out actual time worked
on a job - have 3 Textboxes in a row named Hrs Mins Secs (Start Time)
Next row of 3 Textboxes ( Finish Time) Hrs Mins Secs. Next row 3 Textboxes (DownTime) Next row 3 TextBoxes (Total Time) when odd times are entered it throws a wobbler can you help me to get it to work properly? have attached an example if it will help.

Many Thanks

Sooty8

Bob Phillips
11-13-2008, 01:42 PM
Private Sub Add1_Click()
Dim nTime As Double
nTime = TimeSerial(Val(Tb4.Text) - Val(Tb1.Text) - Val(Tb7.Text), _
Val(Tb5.Text) - Val(Tb2.Text) - Val(Tb8.Text), _
Val(Tb6.Text) - Val(Tb3.Text) - Val(TB9.Text))
Tb10.Text = Hour(nTime)
Tb11.Text = Minute(nTime)
Tb12.Text = Second(nTime)
End Sub

lucas
11-13-2008, 01:42 PM
what is an example of an odd time?

sooty8
11-13-2008, 02:00 PM
Hi xld

The master does it again - didn't know anything about "TimeSerial" which I assume was the way forward.
Many Thanks - Much appreciated - hopefully tomorrow can now try it on an invoice

Lucas
It was throwing a wobbler when say in the minutes I had on one row 45 and on the next row 44 was then getting a minus figure in the final calc.

lucas
11-13-2008, 02:03 PM
If I'd known Bob was on it I wouldn't have said anything. He just fixed it so it would work.

sooty8
11-27-2008, 09:54 AM
Hi Xld

I have hit a snag with your solution to this problem never happened until today the system works perfectly however it works within 24 hours is it possible to choose the number of days it has to work over - say selecting from a drop down box and choose the number of days be it 1,2,3,4,5,6 it would then take in the number of hours worked minus the downtime for each day.

Any help much appreciated

Sooty8.