Division by Zero Error

C

Chip Melton

I have built a query that has a division statement in that
sometimes will be divided by 0 but i just want it to print
a zero. right now the query works buts shows "error!" in
the field for these divided by'0' situations but the
report gives a "Division by Zero!" error and shuts down.
Is there any way to get this report to function properly?
THANKS!!
 
K

Ken Snell

Or

[Numerator] / IIf([Denominator]=0 ,1, [Denominator])
--
Ken Snell
<MS ACCESS MVP>

Brian Camire said:
You might try using the IIf function in expression something like this:

IIf([Denominator]=0,0,[Numerator]/[Denominator])

instead of just

[Numerator]/[Denominator]

Chip Melton said:
I have built a query that has a division statement in that
sometimes will be divided by 0 but i just want it to print
a zero. right now the query works buts shows "error!" in
the field for these divided by'0' situations but the
report gives a "Division by Zero!" error and shuts down.
Is there any way to get this report to function properly?
THANKS!!
 
K

Ken Snell

Yes it would. Anytime you divide by zero, it's an arbitrary choice that you
make as to what the answer should be .... unless you decide how to display
the infinity symbol.

--
Ken Snell
<MS ACCESS MVP>

Phobos said:
Ken Snell said:
Or

[Numerator] / IIf([Denominator]=0 ,1, [Denominator])


That would mean that 12/0 = 12 wouldn't it?

P
 

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

Division by Zero Error 1
"Division by Zero" Question 2
"Division by zero", but... 2
Division by zero error 16
Division By Zero error 2
Division Question 1
division by zero-PLEASE HELP 5
division by zero 5

Top