Link to home
Start Free TrialLog in
Avatar of SCS1ST
SCS1ST

asked on

Divide by zero error encountered

Working on an Access ADP with SQL backend.  I've got this one Function that keeps giving me this error. "Divide by zero error encountered".  This is the statement it gives me this error at:

CASE WHEN [todayconcpoured] > 0 THEN ((([todayconcpoured] / [todaytightconc]) - 1) * 100) ELSE 0 END

Both fields have 0's instead of nulls.  
I have been researching this on EE and I have tried with no success :

CASE WHEN [todayconcpoured] > 0 THEN ((([todayconcpoured] / CASE WHEN [todaytightconc] IS NULL THEN 0 ELSE [todaytightconc] END) - 1) * 100) ELSE 0 END

Can someone help me with this please?
Thanks
SCS1ST
Avatar of apresto
apresto
Flag of Italy image

CASE WHEN [todayconcpoured] > 0 AND [todayconcpoured] IS NOT NULL THEN

try that
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SCS1ST
SCS1ST

ASKER

AngelIII,

Worked beautifully, thanks.