Results 1 to 8 of 8
  1. #1
    wtucker is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Jun 2017
    Posts
    50

    Expression Builder IIF() Question

    Hey everyone,

    I'm stuck on this expression. It's a nested IF function. Everything looks right, and the Microsoft website seems to confirm it, but it's just not working.
    Is there a better way to do nested IF or IFS?

    Code:
    =IIf([Network]="Trilogy","A004",IIf([Network]="PHCS","A003","N/A"))
    Thank you!

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    When you say not working does it not return the results you want or gives an error message?

  3. #3
    wtucker is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Jun 2017
    Posts
    50
    After clicking ok in the Expression Builder, it will reset to a blank logical statement.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Cannot replicate issue.

    Switch() and Choose() can be used in place of nested IIf() (not available to Calculated type field in table).

    =Switch([Network]="Trilogy","A004", [Network]="PHCS","A003", True,"N/A")

    However, probably would not resolve this issue.
    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
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    wtucker, not sure what that means, create a new query with your table(or query) and add this to a column(add Network field as well to make sure it is working) and run it, does it work?

    x: IIf([Network]="Trilogy","A004",IIf([Network]="PHCS","A003","N/A"))

  6. #6
    wtucker is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Jun 2017
    Posts
    50
    Yeah this was a weird one. I tried to save the database and Access crashed. Upon reloading, the logic worked. Go figure.

    Thanks to everyone that contributed!

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I couldn't replicate the issue, either, but why use the Expression Builder instead of simply placing the syntax directly in the Control Source Property?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    My suggestion was just to test to see if you got the results you wanted.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-03-2016, 01:51 PM
  2. expression builder
    By kashrus in forum Access
    Replies: 3
    Last Post: 03-23-2015, 12:44 PM
  3. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  4. An Expression Builder Question
    By ddkolb in forum Reports
    Replies: 3
    Last Post: 06-03-2011, 04:51 PM
  5. Expression Builder or VB ... Help
    By Adynn in forum Access
    Replies: 0
    Last Post: 06-03-2011, 09:51 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