problem with the if statement
[IIf(([A]==0.00),0,(-[C])/[A]*100)]
this is the text of a field...
what i wan to do is when A is 0 then the filed will show 0, else the calculation will start...
but the problem is when i start the report this field will occur an error that saying the value was too large or too smale for a decimal,
and one more problem is when the [A] is 0 this problem happen too.(the field should show 0 and no calculation)
anyone can help me or give any idea?
this is the text of a field...
what i wan to do is when A is 0 then the filed will show 0, else the calculation will start...
but the problem is when i start the report this field will occur an error that saying the value was too large or too smale for a decimal,
and one more problem is when the [A] is 0 this problem happen too.(the field should show 0 and no calculation)
anyone can help me or give any idea?
Comments
Do not use IIf function in a calculation like this. The function evaluates both parameters, then returns one of them. Use ? operator instead:
[[A]==0.00 ? 0 : (-[C])/[A]*100]
Thank you for your reply...Unfortunately it's not fully work as error CS0172 will occur...
will appreciate your helpful reply...
[[A]==0.00 ? 0 : (double)((-[C])/[A]*100)]