How do I Sum Time Values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spleewars
    New Member
    • May 2011
    • 13

    How do I Sum Time Values

    The scenario is based on 2 data fields: "IN" and "OUT": both are time fields and the main function is to serve as a punch clock. In order to work out calculations and get the total time, both were passed into a query and set out the formula:

    datediff ("n",[in],[out])

    So to convert the raw time of the latter formula, i set a new one to divide the amount of 'datediff' into hours and minutes:

    [totalhours]\60 & Format([totalhours] Mod 60, "\:00")

    Everything's fine to here... however, when i loaded the query into a continuous form and set the SUM function into an unbound text box (so i could sum up all the totalhours) ERROR pops up. The control scorce of the textbox is:

    =SUM([totalhours])\60 & Format(SUM([totalhours]) Mod 60, "\:00")

    Obviously the textbox is set in the footer but still resolving the error.

    What is the reason of the error?
    Clara
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    The problem is that 3:45 is not a number. You can't add them up. What you need to do is sum up the minutes and do the conversion back into hours and minutes.

    Comment

    • spleewars
      New Member
      • May 2011
      • 13

      #3
      Big thanks rabbit :) all i wanted was to be enlightened in this case! :)

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Not a problem, good luck.

        Comment

        Working...