Results 1 to 3 of 3
  1. #1
    d9pierce1 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2012
    Location
    Tennessee
    Posts
    203

    Nested IFF Statement in Query not working

    Hi all,


    I have a field in my query that is 1,2 or 3 from an option group. I want to display either Male, Female, or Unknow on my form.
    This is what i was using but i get an error when opening query.
    "Unidentified Function "If" in Expression"

    Gender1: If([Gender]="1","Male",IIf([Gender]="2","Female","Unknown"))

    What am i doing wrong?

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    8,345
    don't use nested IIFs, use a lookup table,
    1, Male
    2,Female

    join the tbl into your query and pull the field needed.

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,330
    I agree with using a table, but for educational purposes your error(s) include having If instead of IIf for the first function and likely the quotes around the numbers.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Nested If Then Statement
    By hithere in forum Programming
    Replies: 8
    Last Post: 02-11-2013, 11:43 AM
  2. Nested If/Or Statement
    By kristyspdx in forum Queries
    Replies: 2
    Last Post: 10-15-2012, 04:49 PM
  3. Nested If statement
    By Bellablue in forum Access
    Replies: 7
    Last Post: 10-09-2011, 12:00 PM
  4. Nested IIf Statement
    By traquino98 in forum Queries
    Replies: 5
    Last Post: 06-11-2011, 10:56 AM
  5. Nested Iif statement help
    By Goodge12 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 11:45 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 - Senior Forums