473,657 Members | 2,598 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 3561
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,568 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,568 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
7077
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 the number has 2 decimal places. Any help would be great. Regards, Brent
2
15860
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 MB, you get the picture. Both the GB and MB assorted values exist in both columns. Is there anyway to convert the GB or MB to 0's, or even better yet decimal places so I can look for values < or > to 6gb. I already tried a query, but it seems...
2
6701
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 to two decimal places. I do not know how to format the numbers in the list box as the Format parameter has more to do with spacing. Thanks, Hank Reed
2
2861
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 Excel spreadsheets supplied by different parties, over which I have no control. My problem is that whilst several parties supply the spreadsheets with the currency fields containing two figures to the right of the decimal place (ie 123.51,...
3
33228
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 number with up to 8 decimal places! Any suggestions how to overcome this problem gratefully received! Paul
4
6941
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 Tables Collection, the Tables Fields Collection, and then the Field Properties Collection but I do not see what I need. I don't want to change the setting. I just want to make a list of the decimal place setting for each "Single" field in
3
76483
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 1,234 using a comma for the thousands and no decimal places. I changed the format on the second text box to: =Format(,”Standard”)
19
3595
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 starting a new one] I'd still like to finish this rounding mess. As a startup lemma we can take that VK is the worst programmer of all times and places: let's move from here forward please. The usability of any program depends on exact behavior...
2
6984
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 field. Markup:(-)/ which is to formatted as Percent with 0 Decimal places. When I click into the Format box is am offered
3
1986
by: David | last post by:
Any ideas why this statement: mBalanceChange = Double.Parse(strCurrentBalance, Globalization.NumberStyles.AllowThousands Or Globalization.NumberStyles.AllowDecimalPoint) - mBalanceDouble would leave me with a double containing over 10 decimal places when strCurrentBalance was a string containing a double with two decimal places and mBalanceDouble contained only two decimal places to begin with?
0
8425
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8622
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.