Results 1 to 2 of 2
  1. #1
    Nyrubi is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    23

    Pls help with nested query criteria

    Hi,


    I have this long nested query that when I run it it will not return the second 601, "SPC". Code 601 can either be an "EMN or "SPC" depending on the case # and member. Thank you appreciate any help you can provide.

    initiated: IIf([tbl_mbrs].[frg_id_cd] in ("401","402"), "YES",IIf([tbl_mbrs].[frg_id_cd] ="601", "EMN",IIf([tbl_mbrs].[frg_id_cd]="601", "SPC",IIf([tbl_mbrs].[frg_id_cd]="602", "Trans", IIf([tbl_mbrs].[frg_id_cd]="603, "Heart",IIf([tbl_mbrs].[frg_id_cd]="604, "SPECIAL"))))))

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Follow the logic: the second if statement checks if the value is 601, when it's not it checks it again for 601. If it was false the first time it'll be false the second time, It'll never return true that second time.

    You'll need something like this bad suedo code: IIF( 401 or 402, yes, IIF (601, IIF( logic to pick between the two values, emn, spc), rest of your nested ifs)

    It might make since to just put these codes in their own table and just do a join on them.

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

Similar Threads

  1. Iff nested query
    By bpalmereng in forum Queries
    Replies: 4
    Last Post: 08-21-2017, 12:03 PM
  2. Criteria controlled nested IIF statement
    By tonycl69 in forum Queries
    Replies: 4
    Last Post: 03-23-2016, 07:50 AM
  3. Nested And/Or query
    By kagoodwin13 in forum Queries
    Replies: 2
    Last Post: 05-10-2012, 12:10 PM
  4. Nested SQL Query
    By springboardjg in forum Queries
    Replies: 5
    Last Post: 05-08-2011, 05:01 PM
  5. nested if statement with two criteria
    By kendra in forum Queries
    Replies: 5
    Last Post: 06-16-2009, 04:07 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