Results 1 to 4 of 4
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862

    Excluding Weekends

    I want to set up where the date set excludes weekends.



    I have code where I set the date for the next day ie: "Tomorrows Issues - " & Date()+1, and I would like it to exclude the weekends. currently if it is a Friday and you get Saturdays date and I need Modays date.

    I found this code, but it seems like it would only affect Saturday, not Sunday.

    IIf(Weekday(Date())=2,Format(Date()-3,"mm/dd/yyyy"),Format(Date()-1,"mm/dd/yyyy"))

    How would I adapt this to include both? Or is this completely wrong for my situation?

    Thanks
    T

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    That's doing the opposite. If it's Monday, it's giving you the previous Friday, otherwise the previous day. You should be able to flip it around.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    I believe you are close. Dim Date()+1 with an identity

    then check it to be the Weekday value that concerns you

    and write the if/then logic to advance the + integer as appropriate

    for sanity I would not attempt to put all in one phrase; chop it into discrete identies or if you are using a query set up in a sequence of individual calculated fields

  4. #4
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    862
    I figured it out:

    WWeekdays: IIf(Weekday(Date())=7,Format(Date()+2,"mm/dd/yyyy"),IIf(Weekday(Date())=1,Format(Date()+1,"mm/dd/yyyy"),Format(Date(),"mm/dd/yyyy")))

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

Similar Threads

  1. working hours excluding weekends
    By sdel_nevo in forum Queries
    Replies: 2
    Last Post: 08-15-2014, 08:52 AM
  2. Date calculation excluding the weekends
    By Aosmond in forum Forms
    Replies: 1
    Last Post: 08-04-2014, 08:27 PM
  3. Calculaeate Difference Excluding Weekends
    By Sumanth.Ganjam in forum Access
    Replies: 2
    Last Post: 04-26-2014, 09:10 PM
  4. DateDiff Excluding Weekends
    By cs93 in forum Programming
    Replies: 1
    Last Post: 03-25-2011, 04:09 PM
  5. Weekday excluding weekends
    By jd316632 in forum Queries
    Replies: 3
    Last Post: 05-24-2010, 02:01 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