I have a Form where these calculations are done for additive to be added to the product. User enters the name, weight of the product and at the Click of the Calculate Button calculations are done. I have been using the following code:
Dim lbs As Double
Dim ozs As Integer
lbs = Val(txtOilWeight.Value) * (Val(lstPercentage1.ItemData(0)) / 100)
ozs = (lbs - Int(lbs)) * 16
amount = (Int(lbs) & " lbs " & ozs & " ozs")
End If
txtAdditive1Amount.Value = amount
End Sub
This code works fine. However, if I Enter weight 45950 lbs. and the additive is 8 oz. per 1000 lbs it displays 22 lbs. and 16 ozs. and not 23 lbs. Why ?
To make this clear, Type, Weight of the additive are all being derived from a table. These calculated weights are not saved in the Table but are displayed in the txtBox.
I am at a loss to understand this. Any HELP will be appreciated
Thanks

Dim lbs As Double
Dim ozs As Integer
lbs = Val(txtOilWeight.Value) * (Val(lstPercentage1.ItemData(0)) / 100)
ozs = (lbs - Int(lbs)) * 16
amount = (Int(lbs) & " lbs " & ozs & " ozs")
End If
txtAdditive1Amount.Value = amount
End Sub
This code works fine. However, if I Enter weight 45950 lbs. and the additive is 8 oz. per 1000 lbs it displays 22 lbs. and 16 ozs. and not 23 lbs. Why ?
To make this clear, Type, Weight of the additive are all being derived from a table. These calculated weights are not saved in the Table but are displayed in the txtBox.
I am at a loss to understand this. Any HELP will be appreciated
Thanks