Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: How do I add 2 hrs to my formula?

    Hello,

    How can I modify the following formula to add 2 hrs (120 mins) to the total time?

    =[Total Hrs]\60 & Format([Total Hrs] Mod 60,"\:00")

    Example: Number of hrs = 2.00 + 2 = 4:00 hrs. I was asked to add another 2 hrs to the formula for travel time.

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    Have a look at the DateAdd function if it's a date. If it's an interval, can't you just do

    =([Total Hrs] + 2)\60 & Format(([Total Hrs] + 2) Mod 60,"\:00")
    Me.Geek = True

  3. #3
    Join Date
    Sep 2008
    Posts
    150
    Excellent Nick! I had to change the hrs to minutes and it works perfect.

    =([Total Hrs]+120)\60 & Format(([Total Hrs]+120) Mod 60,"\:00")


    Thank you.

  4. #4
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    For reference, using DateAdd in Access;

    dateadd("h",2,[YourDateTimeField])

    MS Access Reference
    http://office.microsoft.com/en-us/ac...288101033.aspx

    Transact SQL Reference
    DATEADD (Transact-SQL)
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •