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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum in Report has too many decimal places

Status
Not open for further replies.

eadiem

Technical User
Apr 8, 2004
47
CA
Hi,
I have a table which has a numeric field Acreage. This field is set to Number/Single/Auto Decimal Places. Most values have no decimal places, some have 1 or 2, and a rare record has 3.
However, in my report, I group some of these records and sum them, and the decimal places in the report are way out of whack.
For example, I have one value which should be 0.7 and it came out to 0.699999988079071 in the report. Other sums are perfectly normal...can anyone explain?
I tried deleting the value in the record and retyping it, but no change in the report.
Thanks for any suggestions.
Eadie
 
Well, I'll begin by saying that 0.699999988079071 is so close to 0.7 that most things wouldn't even know the difference.

That being said, are you doing any math function to get the results shown, more specifically division. This typically causes the "symptoms" you are experiencing.

If you can't set the decimal points to a fixed number, then you will need to figure out a way to modify in code...something like:

If Not IsNull(Mid(Cstr([value]],5,1)) Then [value] = Cdbl(Left(Cstr([value],4)))

The above line should take a value of 0.699999988079071 and change it to 0.69...which you may then have to round or whatever....

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
I am not doing any mathematical calculations on this value except for the calculated Sum in the report. In the example I gave, this is the only record in the group, so the Sum of 0.7 becomes 0.6999.... In other cases, I have several records summed in a group and I experience the same problem.
 
You might want to check Luke Chung's article at mail.mvps.org

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Duane - I'd like to get a look at this article. Could you clarify how I can access it? I pasted the link in my browser and couldn't log in to the site.
 
Found it at:
It has a good explanation of why things go wrong in calculations. However I still can't understand why it is happening in my case. Technically i suppose I am doing a calculation in my summation in the report. However not all the sums show up with 15 decimal places, some appear normally.
 
Sorry about pasting the wrong value into the reply. I don't know how I could explain this issue better than Luke. Just set the format of the text boxes to however many decimals you want to show.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top