Solved How to disable Number rounding? (1 Viewer)

SalmanZeiad

Member
Local time
Today, 17:10
Joined
Oct 30, 2017
Messages
112
i have problem when i put price 2.8 become to 3
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 10:10
Joined
Apr 27, 2015
Messages
6,367
Need a little more information. Are you typing this into a form or directly to a table?
 

bob fitz

AWF VIP
Local time
Today, 15:10
Joined
May 23, 2011
Messages
4,727
If your table number field "Field Size" property is set to Integer change it to single.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 10:10
Joined
Apr 27, 2015
Messages
6,367
Thanks. Check the Format properties of that field. Specifically, the number of decimal places.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:10
Joined
Feb 28, 2001
Messages
27,223
Let's be clear. By default, Access shows you what is in the field. If you open the table and look at that value in Datasheet view, is it 2.8 or 3 ?

Rounding occurs when the data type of the field in the table doesn't support the precision you request. ANY of the integer types will do this, including LONG and INTEGER (a.k.a. WORD) data types. If the data type in the table is not SINGLE, DOUBLE, CURRENCY, or DECIMAL then you cannot have decimal points anyway. However, one can find general advice to avoid using DECIMAL anyway because of its issues in data handling.

 

SalmanZeiad

Member
Local time
Today, 17:10
Joined
Oct 30, 2017
Messages
112
Let's be clear. By default, Access shows you what is in the field. If you open the table and look at that value in Datasheet view, is it 2.8 or 3 ?

Rounding occurs when the data type of the field in the table doesn't support the precision you request. ANY of the integer types will do this, including LONG and INTEGER (a.k.a. WORD) data types. If the data type in the table is not SINGLE, DOUBLE, CURRENCY, or DECIMAL then you cannot have decimal points anyway. However, one can find general advice to avoid using DECIMAL anyway because of its issues in data handling.

Also i check the table it`s 3
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:10
Joined
Feb 28, 2001
Messages
27,223
Also i check the table it`s 3

Yes, there is the problem. Bob Fitz's suggestion fixed you this time. For future reference, remember that the table in Datasheet view ALWAYS shows you the native format and accurate content of the field in question unless you have somehow adjusted the Datasheet View internal definitions - which is something even advanced Access user's don't do. So if there is EVER any question, the "true" display of your stored data is always found in the Datasheet view and is the first place to look to tell the difference between a data problem and a formatting problem.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:10
Joined
Feb 19, 2002
Messages
43,352
Doc, If you format the data at the table level, that's what you see in DS view. So, if you have a single or double but set the format to show no decimal places, you'll see a rounded number. If you have a date field that sometimes contains time and you set the format to short date, you never see the time values but they are still there. This one got me good when I took over an app created by someone else. It was early in my Access career and I hadn't yet spent 20 years helping people solve stupid problems like this so it was two days before it occurred to me to look at the format in the table where I discovered the short date format and removed it. Voila. My query results now made sense.

This is why I NEVER EVER format at the table level. I followed this rule instinctively from the beginning in databases I created. No one told me but I knew I wanted to see the data as it was stored, not necessarily how it might be displayed in a form or report. But eventually I learned that my instincts were correct when I started encountering messes made by others. When I open the table in DS view, I want to see what is actually stored. Setting the format property interferes with that.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:10
Joined
Feb 28, 2001
Messages
27,223
Forgot you could do that since it is something I knew to NOT do - because it cuts you off from important debugging information.
Thanks for the reminder, Pat.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:10
Joined
Feb 19, 2002
Messages
43,352
When you understand data, you instinctively avoid formatting at the table level. That's why you forgot. You just don't do it. That's why when I ran into an app where someone had done it, it baffled me for two days.
 
Last edited:

Users who are viewing this thread

Top Bottom