Solved

Currency decimal places

Posted on 1998-11-24
4
1,254 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 50 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

732 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