Results 1 to 8 of 8
  1. #1
    Chris Trent is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    6

    Question Calculate (Sum) multiple time fields

    Hi All



    I am relatively new to access (i've been doing everything on Excel).

    I am trying to make a logbook and I have boxes that calculate times. What I need is another field to give the total of the various times.

    I have absolutely no idea how to do it. I have tried multiple searches on the internet but cannot get my expression to work. I either get a #error or i get the times displayed at concatenated text.

    Im about to give up on Access and stick with excel.

    Any help would be appreciated.

    I've attached a screenshot of what i need to accomplish and the database.

    I would need to have a total of the hours and as well as the decimals
    Attached Thumbnails Attached Thumbnails totals.png  
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you have decimal totals, so sum them
    the bottom text box must sum the decimals, not the timestamps.

    =sum(txtBoxDecimals)

  3. #3
    Chris Trent is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    6
    Thanks for the reply. The summing of the decimals should be straight forward.

    What would the expression be to sum the different time totals?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    That actually won't work either, you can't sum controls, only fields in the data. You'd need this monstrosity:

    =FormatDateTime((DateDiff("n",[1st Sector Start],[1st Sector End])+DateDiff("n",[2nd Sector Start],[2nd Sector End])+DateDiff("n",[3rd Sector Start],[3rd Sector End])+DateDiff("n",[4th Sector Start],[4th Sector End]))/(24*60),4)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Chris Trent is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    6
    Thanks Paul

    It worked great!

  6. #6
    Chris Trent is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    6
    Would I also need a monstrosity to add up the decimals? Just want to make sure i have the correct brackets in the correct places

  7. #7
    Chris Trent is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    6
    I figured it out.

    Thanks so much for your help!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem. You might search on "normalization". Field names with numbers in them are a tip-off to a design flaw. What are you going to do if a flight has 5 segments? I'd have a related table for each segment, which would let you have 1 segment or 100.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. set the value of multiple fields at the same time
    By super_paulie in forum Access
    Replies: 20
    Last Post: 03-09-2018, 09:16 PM
  2. Replies: 5
    Last Post: 09-06-2017, 08:34 AM
  3. Replies: 1
    Last Post: 05-29-2013, 04:01 PM
  4. Replies: 42
    Last Post: 03-01-2013, 06:58 AM
  5. Calculate Multiple Fields for Extended Price
    By SRessler in forum Queries
    Replies: 3
    Last Post: 11-01-2010, 03:57 PM

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