Division by Zero Error

  • Thread starter Thread starter Chip Melton
  • Start date Start date
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!!
 
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!!
 
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
 
Back
Top