IIF Statement Hoopla!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Presto731
    New Member
    • Jul 2007
    • 53

    IIF Statement Hoopla!!

    Isn't the IIF statement a joy.

    I have three IIF statements that all work fine on their own in my query field.

    they are as follows.

    IIf([unit_amt]=1,[split1])
    IIf([unit_amt]=2,[split2])
    IIf([unit_amt]=3,[split3])

    independantly they populate the correct data. How do I join them all together in the same column in my query so I don't have to have 3 columns and they display the correct info. I can't seem to make it work right. Comma here, parenthese there, quote over yonder......... ....STUMPED!
  • Ares6881
    New Member
    • Jul 2007
    • 20

    #2
    Originally posted by Presto731
    Isn't the IIF statement a joy.

    I have three IIF statements that all work fine on their own in my query field.

    they are as follows.

    IIf([unit_amt]=1,[split1])
    IIf([unit_amt]=2,[split2])
    IIf([unit_amt]=3,[split3])

    independantly they populate the correct data. How do I join them all together in the same column in my query so I don't have to have 3 columns and they display the correct info. I can't seem to make it work right. Comma here, parenthese there, quote over yonder......... ....STUMPED!

    If you're looking to imbed them in each other, it should look something like this:

    IIf([unit_amt]=1,[split1],IIf([unit_amt]=2,[split2],IIf([unit_amt]=3,[split3])))

    Basically the way an IIf statement works is

    IIf([argument], [result if it's true], [result if it's false])

    Hope that works for ya

    Comment

    • Presto731
      New Member
      • Jul 2007
      • 53

      #3
      BINGO

      I was missing the last parenthese, thanks Ares!

      Comment

      Working...