Result from a IIf statement

S

souchie40

Don't know if this is possible but I was hoping some can help.

I have a IIf statement who's expersion is -([A]/>[C],[D],0) with A, B, C
and D being fields from a query, what I want to do is have a '0' returned in
the field if the result of [A]/ is 0 at the moment I get an #Error, which
is of course the correct result but this dosen't look good on a report

Many Thanks for your time and Patentice
 
S

Steve Schapel

Souchie,

If the result of [A]/ is 0, I can't see why you would get #Error.
And the only reason you would need to change the expression is if [C]
can ever be a negative value... can it?

You will probably get #Error if =0. Is this the situation you are
referring to? If so, maybe like this might be easiest...
IIf(=0 Or [A]/<=[C],0,[D])
 
S

souchie40

Steve,

Many thanks and your right B can = 0 and the expression works great

Steve Schapel said:
Souchie,

If the result of [A]/ is 0, I can't see why you would get #Error.
And the only reason you would need to change the expression is if [C]
can ever be a negative value... can it?

You will probably get #Error if =0. Is this the situation you are
referring to? If so, maybe like this might be easiest...
IIf(=0 Or [A]/<=[C],0,[D])

--
Steve Schapel, Microsoft Access MVP
Don't know if this is possible but I was hoping some can help.

I have a IIf statement who's expersion is -([A]/>[C],[D],0) with A, B, C
and D being fields from a query, what I want to do is have a '0' returned in
the field if the result of [A]/ is 0 at the moment I get an #Error, which
is of course the correct result but this dosen't look good on a report

Many Thanks for your time and Patentice

 
Top