View Full Version : =SUM() and hidden decimals


swompfrawg
02-28-2001, 09:51 AM
ok i'm pulling my hair out on this one, i searched the forum, followed all the suggestions, and i still can't fix this problem.

In a report I am using =SUM() to total a calculated field from a query. No matter what I do, the =SUM() always returns the wrong total. It's a rounding issue, I know that much http://www.access-programmers.co.uk/ubb/smile.gif

if the report is adding 12.00 and 13.00, the result should be 25.00. But if that 13.00 is actually 13.009234.... in real form, the report uses THAT value instead and returns the result of 25.01. So all my =sums of this calculated field are usually off by .01

Every number field in the tables, queries, and report are all set to fixed, 2 decimals, and double - i've tried single as well. I just want it to ignore anything after the hundredths decimal. Anything i'm missing here?? Thanks for any help!!

llkhoutx
02-28-2001, 10:28 AM
The format only control what decimals are displayed, not the actual value of the data.

To round-off to 2 decimals, multiple your number for 100, convert it to and integer (to loose the decimals), then divide the integer by 100. This way you're rounding the data, which is apparently what you want.

Pat Hartman
03-04-2001, 07:06 PM
There is an article titled "When Access Math doesn't Add up" at the following website. I'm posting the link to the article index because there are several excellent articles there that I want EVERYONE to read. Also, the company makes pretty good products so if you think you might need some good utilities, try their sample apps.
http://www.fmsinc.com/tpapers/index.html

Another solution which will work for you (as long as you don't need more than 4 decimal places) is to define the columns as currancy rather than single or double. Access does not create rounding errors for this data type.