Welcome to computers, and decimal math!!!
Take the following code in ms-access
Public Sub TestAdd()
Dim MyNumber As Single
Dim i As Integer
For i = 1 To 10
MyNumber = MyNumber + 1.01
Debug.Print MyNumber
Next i
End Sub
Here is the actual output of the above:
1.01
2.02
3.03
4.04
5.05
6.06
7.070001
8.080001
9.090001
10.1
You can see that after just 7 additions..already rounding is occurring
and if we add the following line of code to the end of the above:
if MyNumber = 10.1 = True then
msgbox "the number is 10.1"
else
msgbox "the number is somthing else"
endif
The above will actual produce:
the number is something else
What the above means that decimal numbers represented in a computer are only
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13113
a approximation. The solution is to user integer numbers, or in the case of
financial calculations, use currency data type. (the currency data type is a
actually a scaled integer,a nd it fakes the decimal repression by
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13113
representation integer..and moving the decimal point).
Try changing your data types to currency, and that should cure your rounding
problems...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com http://www.members.shaw.ca/AlbertKallal