Results 1 to 6 of 6
  1. #1
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145

    Adding Time Periods

    I am trying to add time periods on a report and the result will be more than 24 hours. I'm trying to add "Short Time" fields and anything over 24 hours produces an inaccurate result. I have converted the periods to a decimal and those add correctly but I would like to see the resut in a time format The decimal total on the report is 46.17 and the time total should be 46:15. Any help would be appreciated. DB attached.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You are storing elapsed time as time of day value?

    Time component can't be more than 24 hours because there are only 24 hours in a day.

    Just as you calculated conversion from hh:mm to decimal in query for each record, have to calculate reverse for the sum.
    Review
    https://learn.microsoft.com/en-us/of...seconds-angles
    https://www.accessforums.net/showthread.php?t=33806

    This is a common topic.
    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.

  3. #3
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    I'm sorry I am not yet following you. I looked at the examples provided and it seemed as though they concentrated on converting from Time format to Decimal format. I can convert the time format to decimal and back in the report and in a query but I can't total the time format to give me total hours and minutes. I also tried to convert the sum of the decimal field in the group heading to the time format and kept getting the wrong amount. Can't seem to get past the 24 hour limit.
    2 processes will work for me. Either converting the sum of the decimal format fiedl in another field in the group header to Short Time format, or summing the Short Time fields in the group header

  4. #4
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    see your report.
    Attached Files Attached Files

  5. #5
    Join Date
    Apr 2017
    Posts
    1,792
    You can either:
    Calculate the sum of times as Datetime (every 24 hours will be stored as 1), and convert it to decimal like CDbl(TheSumOfTimes*24) to display in report as decimal value (i.e. instead 25:30 will be 25.5 displayed;
    The same as above, but you convert total hours to string which looks like it is in time format (Integer part of CDbl(TheSumOfTimes*24) does give the hours, and reminder multiplied with 60 does give minutes. The formula will be like CStr(NumberOfHours) & ":" & Right("00" & CStr(NumberOfMinutes),2));
    Use Excel for reporting - Excel reads the query from Access DB, and displays the summary time in format like "[d]:mm" (For some reason Excel has this kind of formats, but Access doesn't!)

  6. #6
    JonathanT is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    145
    Thank you all for your help. I will have to spend some time trying to understand the code but It is exactly what I was looking for. Time is SO COMPLICATED??

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

Similar Threads

  1. Replies: 3
    Last Post: 03-16-2020, 12:20 PM
  2. Replies: 0
    Last Post: 08-22-2018, 02:58 PM
  3. Replies: 3
    Last Post: 12-04-2015, 08:36 AM
  4. plot points for missing periods of time
    By ajetrumpet in forum Reports
    Replies: 0
    Last Post: 09-13-2010, 05:34 PM
  5. Replies: 16
    Last Post: 01-13-2010, 04:31 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