Results 1 to 5 of 5
  1. #1
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53

    Converting Minutes from a Query to Hours:Minutes on a Report

    Basically I have a table setup where Time Fields are stored. What I need to do is in a Query, have the difference of two Time Fields calculated, and then displayed on a Report. Here's what I have so far...




    Table

    - Start Time
    - End Time


    Query

    Difference Time: DateDiff("n",[Start Time],[End Time])



    All that works fine and shows up on the report, except for the fact that the time is showed in straight minutes, so for a difference of 1:30 minutes, it just shows 90 minutes. I need to make it so that on the report in the Difference Time Text Box, it's showed as 1:30 instead of 90.

    I tried putting the following in the Control Source for the Difference Time Text Box on the report, but it returns an error. I'm not quite sure what I'm doing wrong.

    =[Difference Time] \ 60 & Format([Difference Time] Mod 60, "\:00")

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    TimeDiff: Right("00" & Int(DateDiff("n",[starttime],[endtime])/60),2) & ":" & DateDiff("n",[starttime],[endtime]) Mod 60

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    =Int([Difference Time]/60) & ":" & Format([Difference Time] Mod 60,"00")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Nuke1096 is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Apr 2013
    Posts
    53
    Thanks guys.

    It turns out that..

    =[Difference Time] \ 60 & Format([Difference Time] Mod 60, "\:00")

    ...actually worked fine. The problem was that Difference Time was the same name as my Text Box, which is why I was getting that error. However, I am wondering what the advantages or disadvantages of using your examples instead of the above are?

  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
    Your way is fine; I forget about the backslash method of getting the integer.
    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. Converting minutes into hours in report
    By jinro in forum Access
    Replies: 13
    Last Post: 04-01-2013, 07:06 PM
  2. Field to display hours and minutes
    By burrina in forum Forms
    Replies: 5
    Last Post: 01-19-2013, 05:35 PM
  3. Converting Minutes Into Hours
    By KellyM in forum Reports
    Replies: 8
    Last Post: 04-23-2012, 12:49 PM
  4. Overall Total of Hours & Minutes in Report
    By StevenCV in forum Reports
    Replies: 1
    Last Post: 02-27-2012, 10:48 AM
  5. How to calculate duration in hours & minutes
    By joypanattil in forum Access
    Replies: 0
    Last Post: 11-25-2009, 04:49 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