473,503 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I stop access from removing decimal places?

AdezziFan420
1 New Member
Hi All,
I'm having some trouble here with my access database. When I input a number followed by a decimal and a zero it will display that way in the table. For example I write "15.0" into my text box and then add it to the table, I look at the table and a 15.0 is there.

But when I call that field in the table using VBA it will return as a 15. I need the ability to add a ".0" when it is an integer. Currently it will return other decimals correctly.

I have the data type set in the field to a Single. I have also tried setting it to a double but the same thing happens. I feel like access should be capable of doing this. Please let me know if i'm missing anything.

Thank you.
Aug 14 '17 #1
4 3530
PhilOfWalton
1,430 Recognized Expert Top Contributor
Depending on the size of the number, Single should be fine.

It will probably be stored as 15 in the table, but using the Format function, there are many ways of displaying it.

I suggest you try
Expand|Select|Wrap|Line Numbers
  1. format(MyNumber,"#.0")
  2.  
Where MyNumber is your number. This will format it with one decimal place

Phil
Aug 14 '17 #2
NeoPa
32,557 Recognized Expert Moderator MVP
It's important to understand the difference between what's stored and what's displayed. If you want to enter 1.0 and have 1.0 returned then you're probably thinking of a string. Strings are strings and what you enter is what you get. As strings though, they aren't designed to be arithmetically manipulable.

Numbers, however, are different beasts entirely. What you enter is evaluated and stored in a form that you probably wouldn't recognise if opened in Notepad for instance. In Access there are various defaults for how to display numbers (or number formats). Unless otherwise specified a default format will be used. This is generally equivalent to as many as necessary digits before the point; a point if necessary; as many as necessary digits after the point.

Not always what you want, and not what you want in this particular instance.

Never worry. Most places values are displayed from the data there will be a Format property you can use to control how they're displayed. In those rare cases where there isn't such (In the various Print statements for instance.) you can use the Format() function instead.

NB. Always remember that values should be converted to a human visible format when, and only when, they are at the very last step. Once converted to human-readable form the converted value is no longer of any use as a number.

PS. Join the club! (of ADezii fans :-))
Aug 18 '17 #3
danaluter
9 New Member
You could just adjust your field settings by going to the tables property settings. Instead of " number" as the value use text. You will also see an option to change the decmial placement to 0
Aug 22 '17 #4
NeoPa
32,557 Recognized Expert Moderator MVP
Unfortunately, while that may save you from one small problem it opens you up to a whole bunch of other nasty problems. Simply using text is certainly not an advisable solution.

You'll find this already explained in detail in my earlier post.
Aug 22 '17 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7066
by: Brent Bortnick | last post by:
Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number has 3 decimal places or to 2 decimal places if...
2
15853
by: Bubba | last post by:
I know it's possible, just don't know how to do it. I have a spreadsheet that I imported into access. Two of the columns in the table have Hard Drive space values listed for example 2.45 GB and 453...
2
6685
by: Hank | last post by:
Hello, I am displaying numerical (single) values from a table into a list box using Access 2000. Although the format in the table is for three decimal places, the list box rounds all the columns...
2
2854
by: David Nunn | last post by:
Need to preface that I am not much of an Access type. Doing I have several tables that have currency fields, which I run queries against to compare the figures in both. The data is imported from...
3
33199
by: paulquinlan100 | last post by:
Hi I have a couple of calculated fields in a report, i've set the Decimal Places property to 0 and the format to General Number, however when previewing the report it still comes up with a...
4
6932
by: Hank | last post by:
Hello, I'm running Access 2000. I would like to know if its possible to use VBA code to determine how many decimal places are specified for each table field. Currently I loop throught the...
3
76440
by: Ntl News Group | last post by:
I have a text box that contains the number 1234, I want the value form the text box to display in a second text box so I used: = The problems is that this displays 1234 and I want it to display...
19
3566
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
2
6967
by: hunslair | last post by:
This is a really basic question. I am taking a teach yourself beginners course on Access 2003 and have run into a road block on one practice. In a select query, I have created a simple calculation...
3
1976
by: David | last post by:
Any ideas why this statement: mBalanceChange = Double.Parse(strCurrentBalance, Globalization.NumberStyles.AllowThousands Or Globalization.NumberStyles.AllowDecimalPoint) - mBalanceDouble ...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.