IIF statement failure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tymperance
    New Member
    • Aug 2006
    • 33

    #1

    IIF statement failure

    In a query I have a calculated field that I want to look at field [FEE SCHEDULE]![OFF] and if it does not equal 0.00 return ([FEE SCHEDULE]![OFF] but if it equals 0.00 return [SC 85%]. I have it written as:

    SC: IIf([FEE SCHEDULE]![OFF]<>"0.00",[FEE SCHEDULE]![OFF],IIf([FEE SCHEDULE]![OFF]="0.00",[SC 85%]))

    But all I get is #ERROR. How should I be writing this to return the correct responses?

    Thank you!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Originally posted by tymperance
    In a query I have a calculated field that I want to look at field [FEE SCHEDULE]![OFF] and if it does not equal 0.00 return ([FEE SCHEDULE]![OFF] but if it equals 0.00 return [SC 85%]. I have it written as:

    SC: IIf([FEE SCHEDULE]![OFF]<>"0.00",[FEE SCHEDULE]![OFF],IIf([FEE SCHEDULE]![OFF]="0.00",[SC 85%]))

    But all I get is #ERROR. How should I be writing this to return the correct responses?

    Thank you!
    1) Is [OFF] a numeric field? If it is then you don't need the quotes.

    2) There is no need for the second IIF.

    3) Is [SC 85%] a field?

    Comment

    • tymperance
      New Member
      • Aug 2006
      • 33

      #3
      Originally posted by Rabbit
      1) Is [OFF] a numeric field? If it is then you don't need the quotes.

      2) There is no need for the second IIF.

      3) Is [SC 85%] a field?
      Yes [OFF] is numeric and removing the quotes did the trick. I originally had it written as:

      SC: IIf([FEE SCHEDULE]![OFF]="0.00",[SC 85%],[FEE SCHEDULE]![OFF])

      but changed it to the other trying to make it work. I changed it back to this without the quotes and it worked great.

      Thank you for the quick response!

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Not a problem.

        Comment

        Working...