Iif Or Else Statements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcreary
    New Member
    • Sep 2006
    • 4

    #1

    Iif Or Else Statements

    I have a table Tbl_Computron. I would like to auto update the field "Business Units" in the table based on a condition being met in the "Account Hierarchy" field, with the following syntax: IIf([Account Hierarchy] Like "CEAA*","Invest ment Grade Capital Markets") The thing is, I have over five hundred codes that includes other series such as CEAA, CERB, CEFV etc. and that will have a different business unit other than "Investment Grade Capital Markets". How do I begin to write an iif or else code that will group this for me?

    Like, if account hierarchy begins with the prefixes CEFT.... or CGHY or CVRT or CBTY, then Business units is "x'. Then when the series change, Business units will be something else.
  • lilh0ney05
    New Member
    • Aug 2006
    • 7

    #2
    The Select statement is similar to an If statement. Sometimes however, you can write formulas that are clear and less repetitive using the Select statement. This example evaluates the {Customer.Fax} field to determine if the area code is for Washington state (206, 360, 509) or British Columbia, Canada (604, 250):

    ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''
    Select Case Left ({Customer.Fax} , 3)
    Case "604", "250"
    formula = "BC"
    Case "206", "509", "360"
    formula = "WA"
    End Select
    ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''

    The expression right after the Select Case keywords is called the Select condition. In the above example it is Left ({Customer.Fax}[1 To 3]). The Select statement tries to find the first Case that matches the Select condition, and then executes the statements following it, up until the next Case.

    This is only an example.
    try to study it...........
    hope it helps.......... ...........
    god bless.......... .......

    :)

    Comment

    • lilh0ney05
      New Member
      • Aug 2006
      • 7

      #3
      The Select statement is similar to an If statement. Sometimes however, you can write formulas that are clear and less repetitive using the Select statement. This example evaluates the {Customer.Fax} field to determine if the area code is for Washington state (206, 360, 509) or British Columbia, Canada (604, 250):

      ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''
      Select Case Left ({Customer.Fax} , 3)
      Case "604", "250"
      formula = "BC"
      Case "206", "509", "360"
      formula = "WA"
      End Select
      ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''

      The expression right after the Select Case keywords is called the Select condition. In the above example it is Left ({Customer.Fax}[1 To 3]). The Select statement tries to find the first Case that matches the Select condition, and then executes the statements following it, up until the next Case.

      This is only an example.
      try to study it...........
      hope it helps.......... ...........
      god bless.......... .......

      :)
      lilh0ney05

      Comment

      • mcreary
        New Member
        • Sep 2006
        • 4

        #4
        Thanks, works like a charm

        Comment

        Working...