By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,572 Members | 963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,572 IT Pros & Developers. It's quick & easy.

Format Long Integer fields in query to 4 decimal places

100+
P: 294
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.
Feb 18 '14 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,632
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
Expand|Select|Wrap|Line Numbers
  1. Units        Subtract
  2. 5.5157        3.651
  3. 23.99875      13.88732
  4. 15.99901      8.00034
  5. 12.6          7.88745
  6.  
then the following SQL
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.Units, Table1.Subtract, [Units]-[Subtract] AS Diff
  2. FROM Table1;
  3.  
will yield
Expand|Select|Wrap|Line Numbers
  1. Units        Subtract      Diff
  2. 5.5157        3.651         1.8647
  3. 23.99875      13.88732     10.11143
  4. 15.99901      8.00034      7.99867
  5. 12.6          7.88745      4.71255
  6.  
Feb 18 '14 #2

100+
P: 294
I totally overlooked that. Thanks, ADezii. I can't believe I didn't catch that the field was defaulting to Long Integer.

Thanks!
Feb 18 '14 #3

NeoPa
Expert Mod 15k+
P: 31,485
I had to laugh. It's right up there in the title Mark :-D
Feb 18 '14 #4

100+
P: 294
I'm working on two systems simultaneously - my mind is everywhere this morning. I'll get there haha
Feb 18 '14 #5

Post your reply

Sign in to post your reply or Sign up for a free account.