?
Solved

Currency decimal places in Access 2007

Posted on 2010-08-28
4
Medium Priority
?
740 Views
Last Modified: 2013-11-29
Hi

I need to set a currency field in Access to 6 decimal places ie £1.123456.  However when I do this entries are rounded to 4 decimal places eg £1.123456 becomes £1.123500

Does anyone know why this is happening and how to get around it?

Cheers

Ken
0
Comment
Question by:kenabbott
[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 10

Expert Comment

by:t_hungate
ID: 33549732
Try something like this.

'Round the number to the third decimal
If Len(DeciPart) > 6 Then
DeciPart = Round(DeciPart, 5)
'If number only has five decimal, then no need to go further
ElseIf Len(DeciPart) <= 7 Then
GoTo ender
End If

ender:
'Check DeciPart for correct format
If Left(DeciPart, 1) <> 0 Then DeciPart = 0 & DeciPart
Exit Sub

TLH
0
 

Author Comment

by:kenabbott
ID: 33549747
That looks great but why is setting the currecny field to 6 decimal places in the table not working?  Adding code to everywhere there is a currency input field in this db seems an unnecesary complication
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 1000 total points
ID: 33549762
Ken,By definition, the Currency data type stores four decimal places.  You cannot get it to store more or fewer decimal places than that, although you can change how Access displays those values.BTW, the property you were adjusting for number of decimal places is relevant for displaying data only, and has no impact on how Access actually stores the data.None of the native Access data types allow you to specify the number of decimal places that are actually stored.  If you want that capability, you must go to a server-based RDBMS such as SQL Server, Oracle, MySQL, etc.Patrick
0
 
LVL 10

Assisted Solution

by:t_hungate
t_hungate earned 1000 total points
ID: 33549795
To make the change on the table level, change the data type to number, the format to currency, and set the field size to double.  That will cause the field to retain its decimal places.

TLH
0

Featured Post

Industry Leaders: 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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

770 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