473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Adding currency problems

14
Hi there,

I am currently having trouble with some issues with adding Currency values. I have one column with values of transactions and the other column has a running total. It works great however, because the numbers are rounded (currency), they don't look like they add up right eventhough they do.

For instance: if you add $2,632.1743 and $8.6528, you get $2,640.8271. The problem is when the currency rounds these amounts you get: $2,632.17 and $8.65 equals $2,640.83. So eventhough they are adding correctly, they don't appear too.

Is there a way of making all the numbers in my database only use 2 decimals places thoughout the whole database or something to make everything "appear" to be adding up properly?

Thanks again.
Apr 23 '07 #1
3 3087
pks00
280 Expert 100+
are these fields variables u are using or values read from tables. if the latter then u could try specifing this in the table design

the field in question, u could set the Decimal Places to be 2
Apr 23 '07 #2
Lysander
344 Expert 100+
Hi there,

I am currently having trouble with some issues with adding Currency values. I have one column with values of transactions and the other column has a running total. It works great however, because the numbers are rounded (currency), they don't look like they add up right eventhough they do.

For instance: if you add $2,632.1743 and $8.6528, you get $2,640.8271. The problem is when the currency rounds these amounts you get: $2,632.17 and $8.65 equals $2,640.83. So eventhough they are adding correctly, they don't appear too.

Is there a way of making all the numbers in my database only use 2 decimals places thoughout the whole database or something to make everything "appear" to be adding up properly?

Thanks again.
One solution is to use integers and store all your currency values as cents (or pennies or whatever) and divide by 100 to display the results. That way, no rounding errors.
Apr 23 '07 #3
Jx4
14
Thanks for the suggestions!! I appreciate the help!
Apr 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Willing 2 Learn | last post by:
I'm still having trouble getting my program to do arithmetic in cents(keeping all #'s) then convert the answer in a format of dollars & cents. The main program should add, subtract, scalar...
2
by: Dalan | last post by:
This should not be an issue, but it is. I'm sure that someone knows what little piece of code is needed too persuade Access 97 to include a currency format for labels (Avery, mailing type). Have...
3
by: Dalan | last post by:
Is there any code available to address currency rounding problems in Access 97? Apparently, selecting currency type table fields does not resolve the problem. For instance, in my form I have a...
3
by: Josh | last post by:
I am writing a program where the user inputs currency in US dollars. I want the program to only accept valid currency input, converting the string into the proper type of variable (double?), and...
6
by: Mitchell Vincent | last post by:
Just making sure I'm not missing the boat here, but are there any special routines for doing currency math (fixed precision stuff) in .NET? The wonderful problems of doing math on decimals tend...
5
by: Steven Smith | last post by:
Hi, I'm trying to write a simple program to print invoices for people I do work for. I've got a form with textboxes for descriptions and amounts for items, and some code for printing the...
2
by: =?Utf-8?B?UmljaGFyZCBUb2NjaQ==?= | last post by:
I'm learning Visual Basic using the .Net Framework 2.0. I have been playing with consuming web services in applications. I am using a free web service that gives me information for currency...
1
by: favor08 | last post by:
I'm have automated the creation of an email from Access; whic works fine, but the new email doesn't have the user's default signature on it. Is there any way to either have it find the user's...
10
by: Guillermo_Lopez | last post by:
Hello All, I am using VBA in access to perform some calculations. There is a particular sumation that is wrong (barely). this code is withing a loop. TDist = TDist + TempDist Both TDist...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.