Format Long Integer fields in query to 4 decimal places

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcupito
    Contributor
    • Aug 2013
    • 294

    Format Long Integer fields in query to 4 decimal places

    In my table, a "Units" field may be 5.5157.

    In my query, I am trying to take that number and subtract 2 fields from it.

    The problem is, as soon as that number enters the query it is being rounded. I.e 5.5157 -> 6.0000

    That being said, it also returns the wrong numbers in the calculated field also.

    The property sheet for the "Units":
    Format: Standard
    Decimals: 4

    As for the calculated field, it does not give me the option for decimal places.

    What am I missing? A Format() or possibly a Round() ?

    Thanks.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Try setting the Data Type of both Fields to DOUBLE. If you have a Table named Table1 consisting of the Fields [Units]-{DOUBLE} and [Subtract]-{DOUBLE} with the Data
    Code:
    Units		Subtract
    5.5157		3.651
    23.99875	  13.88732
    15.99901	  8.00034
    12.6		  7.88745
    then the following SQL
    Code:
    SELECT Table1.Units, Table1.Subtract, [Units]-[Subtract] AS Diff
    FROM Table1;
    will yield
    Code:
    Units		Subtract	  Diff
    5.5157		3.651	     1.8647
    23.99875	  13.88732     10.11143
    15.99901	  8.00034	  7.99867
    12.6		  7.88745	  4.71255

    Comment

    • mcupito
      Contributor
      • Aug 2013
      • 294

      #3
      I totally overlooked that. Thanks, ADezii. I can't believe I didn't catch that the field was defaulting to Long Integer.

      Thanks!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        I had to laugh. It's right up there in the title Mark :-D

        Comment

        • mcupito
          Contributor
          • Aug 2013
          • 294

          #5
          I'm working on two systems simultaneously - my mind is everywhere this morning. I'll get there haha

          Comment

          Working...