Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

why are my decimals truncated?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Howards - 18 Jan 2008 16:41 GMT
I have a basic access table and form.  I have several fields that use a
number, with decimals in it.  However, everytime I insert data, either in the
table or the form, it always truncates my decimal values (and does not round
up.)

I have redone the table and form without any improvement.

I have used the auto decimal format.  I have tried the fixed format with 2
decimal values, and it even will convert a 43.4 to 43.00.  I am not sure how
to fix this.  Any ideas?
KARL DEWEY - 18 Jan 2008 16:48 GMT
What precission of number do you have?   Integer, single, double?  

You do know that an integer can only have whole numbers.
Signature

KARL DEWEY
Build a little - Test a little

> I have a basic access table and form.  I have several fields that use a
> number, with decimals in it.  However, everytime I insert data, either in the
[quoted text clipped - 6 lines]
> decimal values, and it even will convert a 43.4 to 43.00.  I am not sure how
> to fix this.  Any ideas?
John W. Vinson - 18 Jan 2008 18:53 GMT
>I have a basic access table and form.  I have several fields that use a
>number, with decimals in it.  However, everytime I insert data, either in the
[quoted text clipped - 6 lines]
>decimal values, and it even will convert a 43.4 to 43.00.  I am not sure how
>to fix this.  Any ideas?

The Format is *irrelevant* to the problem.

The default size for Number is Long Integer. An integer is, by definition, a
whole number.

Open the table in design view, select this field, and look at the field
properties in the lower left corner. The first row will probably say Long
Integer. You can change this to Single or Double.

Better, if you need just two decimal places (say you're storing money values,
although it works for non-money data just as well) is to not use a Number
datatype at all but rather a Currency datatype. This gives you four decimal
places and no roundoff error, which can be a problem with Single or Double.

            John W. Vinson [MVP]
Jamie Collins - 21 Jan 2008 09:11 GMT
On Jan 18, 6:53 pm, John W. Vinson
<jvinson@STOP_SPAM.WysardOfInfo.com> wrote:
> Single or Double.
>
> Better, if you need just two decimal places (say you're storing money values,
> although it works for non-money data just as well) is to not use a Number
> datatype at all but rather a Currency datatype. This gives you four decimal
> places and no round off error

I think you must mean "no round off error at just two decimal places"
because at more than four decimal places CURRENCY will exhibit
banker's rounding, which could be an error if the designer intended
another rounding algorithm.

Better IMO to use the DECIMAL data type, whose inherently rounding
algorithm is that of symmetric truncation (a.k.a. no rounding at
all!); the general approach is to increase the decimal scale by one
(something you can't do with CURRENCY) i.e. an additional decimal
place so the front end application can have do its own explicit
rounding.

Jamie.

--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.