Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

?
Lv 5

Can you help me with a nested IIF statement in Microsoft Access?

I am trying to perform the following logic, but I don't know if I have the statement written correctly and I also know I need strategically placed parentheses, but I'm not sure where to put them. The values enclosed in [ ] are valid field names.

MyField=IIF[Name]="Name1",[ValueA],IIF[Name]="Name2",[ValueB],)IIF([Name]="Name3",[ValueC],0)

Update:

I don't know why it would not display the entire formula. I had exactly 3 nested statements and yes, I need to know where the parentheses go- when I tried it like I would in Excel, putting parens at each IIF and after the result, it said invalid syntax.

5 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    The Syntax of IIF is

    IIF( <condition>, <true value>, <false value>)

    In your case it is

    MyField=IIF([Name]="Name1", [ValueA], IIF(...))

    And you missed out the () !

    Source(s): TaZ
  • unland
    Lv 4
    5 years ago

    Access Iif

  • 1 decade ago

    Don't use nested IF or IIF statements more than 3 levels deep. They're a recipe for disaster. Rethink your logic and use a Case statement instead http://www.techonthenet.com/access/functions/advan... . I've seen a big bucks project fail due to a programmer's intransigence in insisting on using a nested IF statement 13 (thirteen, I am not making this up) levels deep.

  • 6 years ago

    This Site Might Help You.

    RE:

    Can you help me with a nested IIF statement in Microsoft Access?

    I am trying to perform the following logic, but I don&#39;t know if I have the statement written correctly and I also know I need strategically placed parentheses, but I&#39;m not sure where to put them. The values enclosed in [ ] are valid field names. ...

    Source(s): nested iif statement microsoft access: https://shortly.im/UCBeh
  • Anonymous
    5 years ago

    ... ive done my AS database project just before christmas, but if you want just add a dropdown menu with the grades too, noly if that other if statement doesn't work.

Still have questions? Get your answers by asking now.