Rounding Discrepancy

  • Thread starter Thread starter BigJohn
  • Start date Start date
B

BigJohn

The following code is attached to the control *Qty*

Private Sub Qty_AfterUpdate()

Me.TotalFirst = Me.Qty * Me.Price
Me.TotalSecond = Round(Me.TotalFirst, 2)


Me.Command0.SetFocus

End Sub

**Question: when using this code, why would the number 15.485*1 end up as
15.48 and the number 84.915*1 end up as 84.92? It appears that the rounding
function is not rounding the first result and is rounding the second result.
Any ideas why that is happening? All numbers are defined in the table as
Number, Single, 3 decimal places. This is driving me and my client nuts.
Thanks in advance for any help.
 
Thanks for the reply. Apparently the vendor is using 'literal' rounding,
with 5 or less rounding down and 6 to 9 for rounding up. strange but that's
the way it is. so I have to write some code to handle this special vendor.
life is fun isn't it? Thanks again and I enjoyed reading your articles.
great site.
 
Allen Browne said:
Be sure to rename it to something like DoRound() so there is no ambiguity
with the built-in function called Round().

Or RealRound, HonestRound ...

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
Back
Top