how can I sum stop watch time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msamir12
    New Member
    • Dec 2015
    • 12

    how can I sum stop watch time

    Hi all ..
    I have a stopwatch form in Access that records results in a table and I wants to sum the time in this table as it is 00:00:00:00

    Thanks inadvance
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't understand your question. If the time is always 0, then 0 + 0 = 0. There's no point in adding it up.

    Comment

    • msamir12
      New Member
      • Dec 2015
      • 12

      #3
      I wanted to upload the form here and I already archived it into a rar file but it gave me error when uploading ...
      about the time it is hh:mm:ss:ms

      I start time then when I press reset button the time is recorded automatically into the table I want to "sum" this time

      Comment

      • msamir12
        New Member
        • Dec 2015
        • 12

        #4
        the time is not alwas 0 this is the time format 00:00:00:00 that I want to sum

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          First of all, Access doesn't have a data type that is purely time. It always has a date component. The display format might only display the time but that doesn't mean the date part of the field isn't there, it's just not showing it.

          Second, it doesn't make sense to add date time values. What would the result of Christmas + New Years = ? Really, what you want to add is a date time interval. And you have to decide what interval that is.

          To get the interval from a date time data type, you can use the DateDiff() function. So if I wanted to calculate the number of minutes, I could do DATEDIFF(mm, 0, TimerField). Once I have converted the date time field into a time interval, then I can use the SUM() on it.

          Comment

          • msamir12
            New Member
            • Dec 2015
            • 12

            #6
            Is there any way to send you the file ??

            Comment

            • msamir12
              New Member
              • Dec 2015
              • 12

              #7
              here is a link for the file
              4shared is a perfect place to store your pictures, documents, videos and files, so you can share them with friends, family, and the world. Claim your free 15GB now!
              Last edited by zmbd; Dec 23 '15, 10:23 PM. Reason: [z{third party sites are often blocked by firewalls for our experts :) }]

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Sorry, I don't download files from people I don't know.

                Comment

                • zmbd
                  Recognized Expert Moderator Expert
                  • Mar 2012
                  • 5501

                  #9
                  Personally, I would look at storing your time as elapsed milliseconds. This would be a simple integer data type.

                  You can then convert the number of seconds to HH:MM:ss:ms

                  Comment

                  • msamir12
                    New Member
                    • Dec 2015
                    • 12

                    #10
                    so rabbit I sent you the access file to check it .. or tell me the way that you can help me with

                    Comment

                    • msamir12
                      New Member
                      • Dec 2015
                      • 12

                      #11
                      zmbd .. did you check the file ??
                      it is almost the same idea but I cannot sum that time or convert I need help with that as I am a little bit new to access DB and functions... thanks alot for response

                      Comment

                      • zmbd
                        Recognized Expert Moderator Expert
                        • Mar 2012
                        • 5501

                        #12
                        Provided the results are in a table, you should be able to create an aggregate query, as shown here Sum data by using a query once you have the sum, you can then format as needed.

                        You can also do the same within VBA; however, a query would be faster.


                        msamir12: Please understand, many of us cannot or will not d/l un-requested attachments. In my case, such d/l are prohibited by my ITSec staff. For many others, it is part of "safe computing/best practices" not to d/l such files. A practical example as to why can be found here http://bytes.com/topic/access/answer...l-ms-products. this unfourtunate Member opened a file from a trusted source and is now haveing all sorts of issues!

                        Comment

                        • msamir12
                          New Member
                          • Dec 2015
                          • 12

                          #13
                          Thanks zmbd I appretiate it and evaluate your efforts now I understand it very well I just wanted some one to check the case from the source file to give openion depending on case study that is it .. thanks once again for your help so as "Rabbit" as well ..
                          thank you guys

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32656

                            #14
                            Let me just clarify. I suspect the actual format required is hh:mm:ss.ms. hh:mm:ss:ms makes little sense to me and I've never seen fractions of a second shown that way.

                            That said, always remember that what is shown (IE. The format.) is only relevant to data being viewed and any format should only ever be applied as the very last thing before displaying it. Data should always be worked on in its native format.

                            Although Rabbit is correct when he states that adding date/time values together produces results that are meaningless, this is only true for timestamp values. IE. Those representing a specific point in time. Subtracting one timestamp from another can make sense and results in a duration. Durations can sensibly be summed together and I suspect this is what you're talking about here. A duration is also a time (period) and can be stored as a Date/Time just as a timestamp value can. Bear in mind though, that the formatting in Office only really handles timestamps fully. This should only ever be a problem when dealing with durations, or sums of durations, that exceed twenty-four hours though. At least that is true unless any unit greater than hours is involved in the format, such as d, mm, yyyy, etc.

                            So, assuming for now that this won't be the case, you can store your durations in a Date/Time field. Be careful to avoid confusing these values with timestamp values of course.

                            Summing these values together is just as straightforward as summing values of numeric types together.

                            Comment

                            • hvsummer
                              New Member
                              • Aug 2015
                              • 215

                              #15
                              @msamir12:

                              One way that you allow you to sum those data, that is split hh:mm:ss.ms in each field, hh in integer field, mm in integer field, etc...

                              then set the sum condition, like this:
                              mm > 60 -> hh = hh + int(mm/60)
                              ss > 60 -> mm = mm + int(ss/60)
                              ms > 100 -> ss = ss + int(ms/100)

                              Comment

                              Working...