Results 1 to 7 of 7
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318

    Count IIf statement error

    I am getting an error on the following count iif statement. Can you see what the problem is?

    =Count(IIf([Schedule_Status]<>"Unscheduled",IIf([Schedule_Status]<>"In AC Review",IIf([Schedule_Status]<>"In DC Review",IIf([Schedule_Status]<>"In LESPM Review",IIf([Schedule_Status]<>"Returned for Rework",IIf([Schedule_Status]<>"Fnal - Mist",IIf([Schedule_Status]<>"Waiver",IIf([Schedule_Status]<>"FSC Completed",IIf([District]="D1",0))))))))))

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What is the exact error?

    I don't understand what you want. What rule are you trying to enforce - Don't count any records with any of those values?
    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.

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Yes. I want to count all the records for D1 except those that are Unscheduled, In AC Review, In DC Review, in LESPM Review, Returned for Rework, Final - MIST, Waiver or FSC Completed.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Then I don't see need for nested IIf

    =Count(IIf([Schedule_Status]<>"Unscheduled" AND [Schedule_Status]<>"In AC Review" AND [Schedule_Status]<>"In DC Review" AND [Schedule_Status]<>"In LESPM Review" AND [Schedule_Status]<>"Returned for Rework" AND [Schedule_Status]<>"Fnal - Mist" AND [Schedule_Status]<>"Waiver" AND [Schedule_Status]<>"FSC Completed" AND [District]="D1", [District]))

    or

    =Sum(IIf([Schedule_Status]<>"Unscheduled" AND [Schedule_Status]<>"In AC Review" AND [Schedule_Status]<>"In DC Review" AND [Schedule_Status]<>"In LESPM Review" AND [Schedule_Status]<>"Returned for Rework" AND [Schedule_Status]<>"Fnal - Mist" AND [Schedule_Status]<>"Waiver" AND [Schedule_Status]<>"FSC Completed" AND [District]="D1", 1, 0))
    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.

  5. #5
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    Still giving me a #Error. What causes a #Error?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I this case, I expect it means a reference in the expression can't be found. Are all those field names included in the form RecordSource? Are they spelled correctly?

    If you want to provide db for review, follow instructions at bottom of my post.
    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.

  7. #7
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    I found the one part of the expression that was causing the error and deleted it. The formula you gave would work. I will close the post.

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

Similar Threads

  1. Error 3144: Syntax error in UPDATE statement??
    By Paintballlovr in forum Programming
    Replies: 7
    Last Post: 03-26-2014, 12:53 PM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Count Iif statement
    By seth.murphine in forum Queries
    Replies: 3
    Last Post: 04-23-2012, 12:36 PM
  4. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  5. error in count
    By humpz in forum Reports
    Replies: 6
    Last Post: 08-13-2009, 08:20 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