Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subtracting Time Values (Access 2000)

    Could someone tell me how to adjust the formula below to include an IIF, so that IIF the hours worked are greater than or equal to 9, then subtract 1 hour? Also how to adjust it (proper syntax) so I don't have to be dividing by 60 to get the hours? I know the "n" is for minutes right? What do I use for hours? Whoops...edited here..."h", got that part.


    Hours: DateDiff("n",[STime],[ETime])/60

    Thanks
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subtracting Time Values (Access 2000)

    Hours: DateDiff("h",[STime],[ETime]) + (DateDiff("h",[STime],[ETime]) >= 9)

    The expression DateDiff("h",[STime],[ETime]) >= 9 evaluates to either True = -1 or to False = 0. This is exactly what you want to add (add -1 is the same as subtract 1).

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subtracting Time Values (Access 2000)

    Beautiful! Thank you so much Hans...

    A Big Salute <img src=/S/salute.gif border=0 alt=salute width=15 height=20>
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

Posting Permissions

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