PC Review


Reply
Thread Tools Rate Thread

Access 2K2: making numbers up in a query sum

 
 
The Dude
Guest
Posts: n/a
 
      27th May 2010
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
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      28th May 2010
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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making calculated Negative numbers a different color in access 200 =?Utf-8?B?Qi4gUGFyaXpv?= Microsoft Access VBA Modules 3 7th Oct 2005 12:28 AM
Access 2002 ID making Numbers Consecutive in ID Field myland@optonline.net Microsoft Access 2 23rd Dec 2004 10:37 PM
iff statement in access query is making my data shrink opeyemi1 Microsoft Access Queries 0 6th May 2004 11:00 PM
iff statement in access query is making my data shrink opeyemi1 Microsoft Access Queries 0 6th May 2004 11:00 PM
iff statement in access query is making my data shrink opeyemi1 Microsoft Access Queries 0 6th May 2004 11:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:02 PM.