I have a SELECT query with the arguments below to fill in a DataTable. The fields OpeningQuantity
, QtyIn
& QtyOut
from tbWHProduct
are all in MS Access Double format. Sometimes when calculating decimals is involved, somehow the POSBalance returns a long string of decimal points:
e.g. 0 + 2565.4 - 2515.1 returns -50.3000000000002
query = "SELECT ProductID, ProductName, Caption, UOM, RetailPrice, DiscPercent, DiscSum,
MinimumSellingPrice, OpeningQuantity+QtyIn-QtyOut AS POSBalance, Location FROM tbWHProduct
WHERE Disable = FALSE ORDER BY ProductName";
Please help me understand what caused this odd calculation quirk and how I would go about avoiding such problem. Thank you.