Results 1 to 5 of 5
  1. #1
    pranvera is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    8

    iff(datepart..

    Hello guys,



    this formula makes filter which select date older than 3 working days without limit.

    Code:
    <= iif(datepart("w",date()) <=4 ,date()-5,date()-3)


    Can you please help me how to update formula to include a bottom limit ?

    I need to have dates older 3 days ( same as it is now) and not older 5 days ( must not count weekends)


    if you have any idea plese help me.

    thanks!

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    <= iif(datepart("w",date()) <=4 ,date()-5,date()-3) and >= iif(datepart("w",date()) <=4 ,date()-7,date()-5)

  3. #3
    pranvera is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    8
    Quote Originally Posted by weekend00 View Post
    <= iif(datepart("w",date()) <=4 ,date()-5,date()-3) and >= iif(datepart("w",date()) <=4 ,date()-7,date()-5)

    thank you for so fast answer man. It says syntax error can you please check if that is correct ?

    Code:
    FROM DailyMar
    WHERE (((DailyMar.[Move Status])="mvng") AND ((DailyMar.[Req Delivery Dt/Tm])<= iif(datepart("w",date()) <=4 ,date()-5,date()-3) and >= iif(datepart("w",date()) <=4 ,date()-7,date()-5)));

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    should read like these,please recheck the "(" and ")":
    WHERE (((DailyMar.[Move Status])="mvng") AND ((DailyMar.[Req Delivery Dt/Tm])<= iif(datepart("w",date()) <=4 ,date()-5,date()-3) and (DailyMar.[Req Delivery Dt/Tm])>= iif(datepart("w",date()) <=4 ,date()-7,date()-5)));

  5. #5
    pranvera is offline Novice
    Windows 7 Access 2007
    Join Date
    Oct 2010
    Posts
    8
    yes, perfect !!

    thank you a lot!

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

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