IIf(IsError... in a query

B

beppe005

I am trying to use the two functions IIf and IsError in a query in this way,
which is wrong (since it doesn't work):

Total: IIf(IsError([field1]/[field2];0;[field]/[field2])

my intenttion is that, if the result of the division is "error", for example
because [field2]=0, then value of [Total] is "0", otherwise the result of
the division should be the true result of the division.

TIA
Beppe
 
R

Reggie

beppe005, Try something like this:

Total: IIf(Nz([Field2],0)=0,0,(Nz([Field1],0))/[Field2])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

IIf(IsError... 4
How to display multiple IIf results in one column 1
combining 2 expressions 3
Count Problem 3
Help in Coding please. 4
#Error 5
IIF Statement 2
Calculating average of average 3

Top