开发者

MS Access Overflow - Dealing with division by 0

I have the following expression in an MS Access Query, where some of these values can be null and despite the cast to a Decimal and the开发者_如何学编程 Not Zero (NZ) function, I still get an overflow error.

Sum(Cdec(Nz([TotalPrice]/([tbl_ArticlesPerOrder]![Amount]*[Total])*[tbl_ArtikelRemoveFromSawList]![Amount]),0))

EDIT: Removing the TotalPrice division removes the overflow. So I suspect a division by 0. Any way to deal with that?


I would try to see if you can build an IFf statement within your sum to handle the division by zero.

e.g.

IIf([tbl_ArticlesPerOrder]![Amount]*[Total])=0,0,[TotalPrice]/([tbl_ArticlesPerOrder]![Amount]*[Total])

MS LINK: Avoiding divide by zero errors in Access

(Edited based on Kev's comments)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜