Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Currency decimal places in Access 2007

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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 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