Results 1 to 4 of 4
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Trying to take time off of noon

    Hello all,

    I am creating a work schedule and I want to be able to subtract 30 or 45 minutes from the start time of the job so that my report will basically say "please show up at work at: 8:45" for a 9:00 job. I have this code on my report right now that works for all start times except for a Noon start time
    Code:
    =DateAdd("n",-[addtostarttime],[start time])
    Somewhere in the back of my brain I recall reading something a long time ago about dealing with noon and midnight. I just can't figure it out though.



    Thanks in advance!!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Noon = 12:00 PM
    Midnight = 12:00AM


    Midnight has a "problem" because of the day issue. If you are subtracting 15 min and the start time is between 12:00AM and 12:15AM, you need to include the date part. Any other time, the formula returns the correct time.

    Noon doesn't have the day problem because it doesn't cross into another day.

    Does this help? I didn't really see a question....

  3. #3
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Quote Originally Posted by ssanfu View Post
    Noon = 12:00 PM
    Midnight = 12:00AM


    Midnight has a "problem" because of the day issue. If you are subtracting 15 min and the start time is between 12:00AM and 12:15AM, you need to include the date part. Any other time, the formula returns the correct time.

    Noon doesn't have the day problem because it doesn't cross into another day.

    Does this help? I didn't really see a question....
    Thank you for your time! You're right, noon wasn't an issue - there was other data in the field which caused the error.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Ready to mark this solved?

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

Similar Threads

  1. Replies: 42
    Last Post: 03-01-2013, 06:58 AM
  2. Replies: 1
    Last Post: 08-14-2012, 03:22 AM
  3. Replies: 1
    Last Post: 02-28-2012, 09:16 PM
  4. Replies: 7
    Last Post: 08-04-2011, 07:49 PM
  5. Replies: 12
    Last Post: 02-22-2011, 03:39 PM

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