Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Currency Accuracy 1

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
AU
Hello,

For some time now I have noticed that Access does not give accurate results when adding curency fields. Here is an example of an invoice adding GST (Tax)

On a continous form there is a GST (currency field) with this code attached
Code:
on Lost Focus GST = Nz([STotal]) * 0.09999
Over at least 4 entries on the invoice the GST amount calculated is about 2c out.
The total as recorded on the Form Footer is recorded as $42.60
When the individual items are added with a calculator is comes to $42.62c

How can I get this to be accurate. I have tried setting the GST field to 2 decimal points, I have tried different combinations as in the above code ranging from 0.1 to 0.09999 etc, but still not accurate.

Cant seem to get it right..
Integrity
 
Seems like the rounding of the sum is not equal to the sum of the roundings...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,
Thank your for your reply. Could you explain this a bit further and what do I do about it.


Many thanks,

Integriyt
 
How is calculated the total in the form footer ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,
The calculation in the Form footer is
Code:
 GSTA = sum([GST])


Set to currency
Many thanks
Integrity
 
What about replacing this:
GST = Nz([STotal]) * 0.09999
with this ?
GST = Round(Nz([STotal]) * 0.01, 2)

FYI, a Currency variable holds 4 digits after the decimal point.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,
Many thanks for your reply. As usual your help was great and appreciated. Now no more problmes with governments wanting their last cent!

Thank you

Integrity


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top