Results 1 to 9 of 9
  1. #1
    KellyM is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8

    Converting Minutes Into Hours


    One of my fields is Minute. I am creating a report and the minutes will be in the Detail section of the report. For group footer, I would like to sum up all minutes spent working on a project but I want to display it as hours and minutes instead of just minutes. For exampe, for 90 minutes, I want it to display as 1 hour 30 minutes. How do I convert the minutes into hours?

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Something like this should work

    int(yourfield/60) & " hours " & yourfield-(60*(Int(yourfield/60))) & " minutes"

  3. #3
    RagJose is offline Seasoned user
    Windows XP Access 2002
    Join Date
    Apr 2012
    Location
    Brazil
    Posts
    42
    I would just add to jzwp11's answer suggesting using "sum(yourfield)" instead of just "yourfield", so it would add all the occurrences before the group footer.

  4. #4
    KellyM is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8
    Thanks! Where do I place that code in my report?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'd simply the minutes calculation with the Mod operator:

    ?int(255/60) & " hours " & 255 Mod 60 & " minutes"
    4 hours 15 minutes
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    RagJose is offline Seasoned user
    Windows XP Access 2002
    Join Date
    Apr 2012
    Location
    Brazil
    Posts
    42
    Quote Originally Posted by KellyM View Post
    Thanks! Where do I place that code in my report?
    As the ControlSource of a control you must create in your group footer to show the total time.

  7. #7
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Assuming that you already have a control for your sum (in minutes), I would just add a new textbox in the same location with the expression (mine or Paul's) and reference your sum control name in place of the "yourfield" in my expression.

  8. #8
    KellyM is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    8
    Thanks - that worked perfectly!

  9. #9
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. Good luck with your project.

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

Similar Threads

  1. Overall Total of Hours & Minutes in Report
    By StevenCV in forum Reports
    Replies: 1
    Last Post: 02-27-2012, 10:48 AM
  2. slow query when asking for sum of minutes
    By sf827 in forum Queries
    Replies: 13
    Last Post: 01-04-2012, 09:00 PM
  3. Replies: 3
    Last Post: 09-01-2011, 11:07 PM
  4. How to calculate duration in hours & minutes
    By joypanattil in forum Access
    Replies: 0
    Last Post: 11-25-2009, 04:49 AM
  5. IF Statement with Minutes
    By sal_gxer in forum Queries
    Replies: 0
    Last Post: 02-12-2007, 08:39 AM

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