If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
"Division by Zero" Question
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. |
#2
|
|||
|
|||
"Division by Zero" Question
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 AccessIM wrote: 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. |
#3
|
|||
|
|||
"Division by Zero" Question
Thank you, John! That worked great.
"John Spencer" wrote: 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 AccessIM wrote: 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. |
Thread Tools | |
Display Modes | |
|
|