"Division by Zero" Question

A

AccessIM

I have a calculated field shown below:

CasesReplenished: (([Item_Pack]*[ActQty])/[Vendor_Pack])

The field works great and the calculation is correct but, when I try to sort
by this field, I receive a "Division by zero" error.

Can someone tell me why this is and how I can sort by this field?

Thank you so much.
 
J

John Spencer

As a guess, in at least one place Vendor_Pack is zero.

Try changing your expression to
CasesReplenished: IIF(Vendor_Pack=0,Null,(([Item_Pack]*[ActQty])/[Vendor_Pack]))

Or if you want a different calculation then
CasesReplenished:
IIF(Vendor_Pack=0,[ActQty],(([Item_Pack]*[ActQty])/[Vendor_Pack]))


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
A

AccessIM

Thank you, John! That worked great.

John Spencer said:
As a guess, in at least one place Vendor_Pack is zero.

Try changing your expression to
CasesReplenished: IIF(Vendor_Pack=0,Null,(([Item_Pack]*[ActQty])/[Vendor_Pack]))

Or if you want a different calculation then
CasesReplenished:
IIF(Vendor_Pack=0,[ActQty],(([Item_Pack]*[ActQty])/[Vendor_Pack]))


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have a calculated field shown below:

CasesReplenished: (([Item_Pack]*[ActQty])/[Vendor_Pack])

The field works great and the calculation is correct but, when I try to sort
by this field, I receive a "Division by zero" error.

Can someone tell me why this is and how I can sort by this field?

Thank you so much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Division by Zero Error 1
Division By Zero error 2
Division by zero error 16
Division by Zero Error 4
Division by Zero Error 3
Division Question 1
division is zero error in query 7
division by zero 5

Top