• Format time over 24 hours

    Author
    Topic
    #470666

    I’m using the following in a control source on a report to express a running total in hours and minutes, even if the total is greater than 24 hours:

    =Int([txtrunsum])*24+DatePart(“h”,[txtrunsum]) & “:” & DatePart(“n”,[txtrunsum])

    It’s working well, but if the minute portion is less than 10 minutes, the time is displayed as 36:5, for example. The toal is 5 minutes and I would like it displayed as 36:05.

    If the minutes are greater than 10 it displays correctly; 65:30, as an example.

    I’m hoping for a simple adjustment, as this really works well other than the minute issue!

    Thanks in advance.

    Viewing 1 reply thread
    Author
    Replies
    • #1236853

      Egghead,

      Could you please provide a sample [txtrunsum] value. I’m a bit puzzled since DatePart wants a Variant(Date) as the second argument and you seem to be passing it a string. I’m sure the string represents a date/time value but I’d just like to see what the function is getting.

      Thanks.

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1238098

      Instead of =Int([txtrunsum])*24+DatePart(“h”,[txtrunsum]) & “:” & DatePart(“n”,[txtrunsum])

      Try: =Int([txtrunsum])*24+DatePart(“h”,[txtrunsum]) & “:” & Format(DatePart(“n”,[txtrunsum]), “00”))

    Viewing 1 reply thread
    Reply To: Format time over 24 hours

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: