1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access nested IIF's

Discussion in 'Business Applications' started by haydenbl, Jul 6, 2018.

Thread Status:
Not open for further replies.
  1. haydenbl

    haydenbl Thread Starter

    Joined:
    Jul 6, 2018
    Messages:
    1
    I have looked at this statement too long and still can't figure it out. I know it's something easy, but I just can't see it. I get the error statement "The expression you entered has a function containing the wrong number of arguments."

    This is my IIF statement:

    UserState: Left(Trim(IIf([Temp10] Like "*NEW USER'S REGION*",
    Trim(Replace([Temp10],"NEW USER'S REGION:","")),
    IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRA>>","")),
    IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRAC-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRAC-FRA>>","")))),2)



    Thanks for your help.
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    It is a tricky one without actually building it, but it looks as if you have 8 Right Hand ( and 9 Left Hand )
     
  3. Chawbacon

    Chawbacon

    Joined:
    Jul 9, 2018
    Messages:
    540
    First Name:
    Jack
    Hello Haydenbl,

    It appears that you have three independent IIF statements instead of one Nested IIF statement in your expression. This observation is based upon the non-quoted comma placement. Therefore, having three independent arguments, Access throws up the wrong number of arguments error.

    UserState:
    1. Left(Trim(IIf([Temp10] Like "*NEW USER'S REGION*",
    Trim(Replace([Temp10],"NEW USER'S REGION:","")),

    2. IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRA>>","")),

    3. IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRAC-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRAC-FRA>>","")))),2)

    You could try a variation on the following: (I have not checked this... Just a quick modification idea)

    UserState: Left(Trim(IIf([Temp10] Like "*NEW USER'S REGION*",
    Trim(Replace([Temp10]"NEW USER'S REGION:")),
    IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRA>>"),
    IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRAC-FRA*",
    Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRAC-FRA>>)",")))

    I hope this helps,

    Chawbacon
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1212523

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice