DivideByZero Error With Crystal Reports - Divide By Zero

  Print

Problem:

Report Runner or Crystal Reports is showing an error from a formula of DivideByZero (divide by zero).

Solution:

That "DivideByZero" message is actually an error in the report (not anything with our Report Runner software).

DivideByZero occurs when you are either dividing a number by 0 or 0 by a number. Crystal "crashes" when this happens. You would get that same error if you ran the exact same report in Crystal Reports.

There is a standard "trick" to fix the formula in Crystal Reports. You simply check the value of each number before you divide them, to make sure neither is a zero. It would look something like this:

If {table.value1} <> 0 And [table.value2} <> 0 Then
{table.value1} / {table.value2}
Else
0

 



Related Articles

Login

 
Forgot password?
Register now

Language