?
Solved

Currency decimal places

Posted on 1998-11-24
4
Medium Priority
?
1,258 Views
Last Modified: 2012-06-27
I have a VB6 front end and Access 97 backend project where the customer insists on searching for a dollar amount and applying a percentage increase or decrease.  If we start out with $20.00 and apply 10% increases all is well but as I test the app and apply numbers like 11.11% to $20.00, Access stores 3 ad 4 significant figures to the right of the decimal point in the table.  Then, when the User searched for an amount like $34.47 and the value stored is $34.467, it is never found.  How can I ensure that only two decimal values get stored.  I am using currency with 2 decimal places.
0
Comment
Question by:SiscoKid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:chewhoung
ID: 1969259
How do you search for an amount? By query? If so, in your query you have to format the amount field to 2 decimal to accomplish this.

Post your query so we can have better understanding.
0
 
LVL 1

Accepted Solution

by:
ssam earned 150 total points
ID: 1969260
In your datatable, make sure the field type is
currency (i'm sure it probably already is), and try changing
the decimal places from auto to 2 in the field properties.
also, as chewhoung notes, you may have to change properties
in querries, reports, etc.
 
An alternative might be to add a
rounding statement in the VB code before stuffing the field.
0
 
LVL 1

Expert Comment

by:ssam
ID: 1969261
addendum from ssam:  also, set the format in your table to
'fixed.'
0
 

Author Comment

by:SiscoKid
ID: 1969262
I changed the query to include a Format statement "#.00" so only two decimal places gets stored.  The number of decimal places in the field definition within the table affects the display of the data not the way the data is stored.
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question