Solved

Currency decimal places in Access 2007

Posted on 2010-08-28
4
735 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 92

Accepted Solution

by:
Patrick Matthews earned 250 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 250 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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...
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

717 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