Solved

Currency decimal places in Access 2007

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now