Decimals rounding up to whole numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reginaldmerritt
    New Member
    • Nov 2006
    • 201

    #1

    Decimals rounding up to whole numbers

    I have a table with fields which need to hold 3 decimal placed numbers. e.g. '0.934'.

    However, the numbers get rounded up to '1' and never displayed as '0.934'.

    I have the field's properties set to 3 Decimal places and I have tried all different types of field size settings.

    What do I need to to to make the filed hold and display decimal numbers?

    Thanks.
  • Darren McDonald
    New Member
    • Aug 2010
    • 7

    #2
    You need to change the field size to either single or double. I think you have it set as integer or long.

    Comment

    • reginaldmerritt
      New Member
      • Nov 2006
      • 201

      #3
      Thanks Darren. I thought Integer or Decimal would allow for decimal places. Your quite right in saying single or double is the correct field size to use.

      Setting field size to single fixed my problem, many thanks.

      Wasn't sure if it was the field size setting or something else but in any case i guess i should have looked here first. http://office.microsoft.com/en-us/ac...010274716.aspx

      Many Thanks.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Single and Double can work for you in a limited way, but especially with Single, you can run into problems when dealing with rounding of calculations. The more appropriate settings would be :
        Data Type = Number
        Field Size = Decimal
        Scale = 3

        To show this data it may also be helpful to set :
        Format = Standard
        Decimal Places = 3

        If you're determined to use a floating point type (Field size = Single or Double) then I would certainly recommend Double as it has more precision so is less likely to suffer from rounding errors.

        Comment

        • reginaldmerritt
          New Member
          • Nov 2006
          • 201

          #5
          I'm now using Decimal Field Size, I didn't realise I had to set the Scale property when using a Decimal Field Size, this is why it didn't work for me before.

          Many thanks, Neo Pa.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Glad to help Reginald :)

            Comment

            Working...