Solved

Currency decimal places

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HasData 9 37
Listbox not remembering select items when come back to the record 5 28
subtract 1 in Access 2003 query 7 39
MS Access Order Smallest to Biggest Query Help 13 42
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now