?
Solved

Currency decimal places in Access 2007

Posted on 2010-08-28
4
Medium Priority
?
756 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
  • 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

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

850 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