#Error

L

LJG

Hi Guys,

Any suggestions why I am getting the #error with this

Margin: Nz([gp],0)/Nz([discount1],0)/100

This happens if the field discount has a value of 0
 
F

fredg

Hi Guys,

Any suggestions why I am getting the #error with this

Margin: Nz([gp],0)/Nz([discount1],0)/100

This happens if the field discount has a value of 0

In math, what is the result of Zero divided by 3?
Zero.

What is the result of 3 divided by zero?

You cannot divide a number by 0, so you received an error when
[discount1] is null ... Nz([Discount1],0).

Test for 0 before doing the calculation.

Margin:IIf(Nz([Discount1],0) = 0 , Null,Nz([gp],0)/[Discount1]/100)

You'll get 0 if [gp] is null and [Discount1] has a value, an empty
field (Null) if [Discount1] is null, or the result of
[gp]/[Discount1]/100 if both fields have a value other than zero.
 
Top