Consulting

Results 1 to 6 of 6

Thread: Solved: Job Time Problem

  1. #1
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    188
    Location

    Solved: Job Time Problem

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    what is an example of an odd time?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    188
    Location
    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.

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If I'd known Bob was on it I wouldn't have said anything. He just fixed it so it would work.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    VBAX Contributor
    Joined
    Aug 2007
    Posts
    188
    Location
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •