percentage error message

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
 
A

Allen Browne

You can't divide anything by zero, so use IIf() to explicitly handle that
case:
Margin: IIf([discount1] = 0, 0, [gp] / [discount1])

You may end up with:
Margin: CCur(Nz(IIf([discount1] = 0, 0, [gp] / [discount1]),0))
 
Top