Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    msamir12 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2015
    Posts
    9

    Exclamation : how can I sum stopwatch time


    I have a stopwatch form in Access that records results in a table and I wants to sum the time in this table
    the time is recorded in this format "hh:mm:ss:ms"
    and this is an example "00:00:51:66"
    if you want the file I can attach the link for the access file .. please I need a fast response

    Thanks inadvance

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933

  3. #3
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    take a look at this link - http://www.excelguru.ca/content.php?184

    suggest you will need a udf to split your string into its component parts then multiply each part by the respective number of milliseconds and add them together. google the split function.

  4. #4
    sneuberg is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Posts
    23
    Quote Originally Posted by Ajax View Post
    take a look at this link - http://www.excelguru.ca/content.php?184

    suggest you will need a udf to split your string into its component parts then multiply each part by the respective number of milliseconds and add them together. google the split function.
    Actual time when assigned to a double is the fractional part of a day. So to get milliseconds for example you just multiple it by 24 * 60 * 60 * 1000

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I expect this data is text, not a date/time. AFAIK, will have to parse the text string into its constituent parts, calculate each to a common unit such as seconds, add the four parts then Sum the records.

    This would be easier if each part was in a separate field. However, use string manipulation functions to extract the parts. VBA is not needed as long as the string structure is consistent. Calculations in query:

    Hrs: Val(Left([fieldname],2))
    Mins: Val(Mid([fieldname],4,2))
    Secs: Val(Mid([fieldname],7,2))
    Mss: Val(Right([fieldname],2))

    TotalSecs: Hrs * 3600 + Mins * 60 + Secs + Mss / 1000

    Now Sum on TotalSecs.

    However, be aware these calcs will error if the field does not have value.

    How do you get the data down to ms? Are you using Windows API code?

    Attaching db wouldn't hurt.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You don't provide much info. Did you understand what Ajax meant?
    How are your VBA coding skills?
    What have you tried?


    Edit...
    Oops, I missed that June...
    Must have been on the phone too long and didn't refresh the window.

  7. #7
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    cross posted here today also (3 places now)
    http://www.mrexcel.com/forum/microso...atch-time.html
    I was helping there, but not as of now...
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    sneuberg is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Posts
    23

    Queries that sum times

    The attached database has queries that implement the suggestions previously posted. Hope this helps.
    Attached Files Attached Files

  9. #9
    msamir12 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2015
    Posts
    9
    Quote Originally Posted by sneuberg View Post
    The attached database has queries that implement the suggestions previously posted. Hope this helps.
    @sneuberg Thanks a lot for your help I don't know how to thank you in this. I only wonder the final sum is in milliseconds . . correct ??
    this is a wonderful work believe it

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Calculations in post 6 return value in seconds. Could change for hours or minutes - just means more decimal digits.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    msamir12 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2015
    Posts
    9

    here is the original file

    this is the stopwatch file if you want to edit it with the new values

    DB stopwatch.accdb

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Edit for what new values?

    Modify the formula as you see fit. It's just arithmetic converting time parts to common unit.

    Have you made any attempt to build query with suggested expressions?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    msamir12 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2015
    Posts
    9
    Quote Originally Posted by June7 View Post
    Edit for what new values?

    Modify the formula as you see fit. It's just arithmetic converting time parts to common unit.

    Have you made any attempt to build query with suggested expressions?

    @june7 thanks alot I am sorry I will give a try as I catch cold and sick a little bit thanks again for your help and sorry for the delayed response

  14. #14
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You have the field in Table1 named "Time". This is a reserved word and an intrinsic function.

    You also have some corruption in the dB you posted. I recreated your dB (well, most of it).

    I changed the field name
    I modified the code.
    I modified the form.
    I thought there should be 3 digits for the milliseconds, so I also modified that.


    This has given me some ideas - I might add a couple of lap times.

  15. #15
    msamir12 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2015
    Posts
    9
    Hi Guys ..

    Honestly I donno how can I thank you for this ... all of you .. really this is the final file of the whole work yet I needed to ask for one thing about the file.. how can I count every time as it is an individual time and make an equation to save the total seconds on total time trials
    Ex: assume that I have trials for some test and each time I record the time for every trial and I already calculated the sum of seconds and I want this sum to be (total seconds/total trials) to know the average for handling the trials .

    thanks a lot guys for help I am really very glad StopWatch new.zip

    File attached

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-11-2015, 03:54 AM
  2. Replies: 2
    Last Post: 08-21-2014, 08:36 AM
  3. Replies: 5
    Last Post: 07-24-2014, 07:54 AM
  4. Replies: 42
    Last Post: 03-01-2013, 06:58 AM
  5. Replies: 1
    Last Post: 02-28-2012, 09:16 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums