A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access 2K2: making numbers up in a query sum



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 09:45 PM posted to microsoft.public.access.queries
The Dude
external usenet poster
 
Posts: 30
Default Access 2K2: making numbers up in a query sum

Hi all!

I am running a query in a subform where I sum a [number of units] *
[operation sign]. Units are imported from a csv file with 3 decimals and
operation sign is either -1 or +1:
For example, [440.000*-1] + [550.070*+1]... etc...

For a strange reason, Access shows 7 to 9 decimals in the sum's result. Now
they are not zeros and it seems like it's calculating on something but I
can't figure what!
The problem is that the result is wrong, and the only way I can get a good
result is by formating like "#,##0.000" the product of the two.

This is just insane and I can't understand why it would do that...

Any thougts?
Thx
T_D
  #2  
Old May 28th, 2010, 04:46 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Access 2K2: making numbers up in a query sum

Floating point numbers can act like that. The problem is that the fractional
portion of a number often cannot be accurately represented. For instance, in
a base 10 system there is no way to completely resolve 1/3. Similiarly, in a
binary system there are fractions that cannot be fully resolved. Now throw in
the complication of converting between the two systems - binary and decimal
and fractional portions of numbers introduce slight differences.

Since you are accurate to 3 decimal points try using CCur to cast the results
into the special fixed decimal (4 places after the decimal) that currency
represents.

CCUR([Number of Units]) * CCur([Operation Sign])

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

The Dude wrote:
Hi all!

I am running a query in a subform where I sum a [number of units] *
[operation sign]. Units are imported from a csv file with 3 decimals and
operation sign is either -1 or +1:
For example, [440.000*-1] + [550.070*+1]... etc...

For a strange reason, Access shows 7 to 9 decimals in the sum's result. Now
they are not zeros and it seems like it's calculating on something but I
can't figure what!
The problem is that the result is wrong, and the only way I can get a good
result is by formating like "#,##0.000" the product of the two.

This is just insane and I can't understand why it would do that...

Any thougts?
Thx
T_D

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.