Results 1 to 3 of 3
  1. #1
    khughes46 is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Grapevine, TX
    Posts
    231

    Nested IIF not working?

    I am calculating a date difference (Calendar Days: DateDiff("d",[EnrollmentDate],[WithdrawalDate]).
    Then trying to adjust for weekends and holidays:
    Class Days: IIf([EnrollmentDate] Between #8/24/2014# And #10/1/2014#,[Calendar Days]-11),IIF([EnrollmentDate]Between#08/24/2014#and#11/01/2014#,[Calendar Days]-21))
    If I run the first IIF it works fine, but as soon as I add the nested IIF I get:
    Expression contains invalid syntax or enclose text in quotes.


    If I run the second IIF as stand alone it too works fine.
    What am I missing in the nesting?

  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,643
    You've closed off the first IIf() before the second. Remove the closing parentheses between 11 and IIf.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Remove the ) after -11.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Nested IF
    By balajigade in forum Queries
    Replies: 3
    Last Post: 10-04-2014, 10:23 AM
  2. nested iif
    By slimjen in forum Reports
    Replies: 1
    Last Post: 03-15-2014, 09:30 AM
  3. Replies: 1
    Last Post: 10-29-2012, 11:24 PM
  4. Nested IIF
    By Oldie in forum Queries
    Replies: 1
    Last Post: 02-17-2012, 06:04 AM
  5. nested functions not working in 2010?
    By Gdm in forum Queries
    Replies: 2
    Last Post: 08-02-2010, 08:02 AM

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