Solved

Currency decimal places

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

685 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