423,485 Members | 1,648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,485 IT Pros & Developers. It's quick & easy.

Misbehaving decimal places

Expert 100+
P: 1,287
I have a table with currency fields set to 2 decimal places.

My query has

Percent: IIf([estimate]=0 Or IsNull([estimate]),0,[balance]/[estimate]*100)

Even with a balance and estimate with 1 digit decimals I'm getting 13 digits in the Percent field. My form's textbox is set to Fixed and 2 decimal places, but it refuses to behave. I ended up switching all my $ fields from Number to Currency because of this problem. I'm reluctant to put Round() in the query because it's very slow already. Is there any good way to take care of this on the form?
Dec 1 '08 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,584
@ChipR
You can give this a try:
Expand|Select|Wrap|Line Numbers
  1. Percent: IIf([estimate]=0 Or IsNull([estimate]),0,FormatNumber([balance]/[estimate]*100,2))
Dec 2 '08 #2

Expert 100+
P: 1,287
Works great and no noticable time difference. Thank you ADezii.
Dec 2 '08 #3

ADezii
Expert 5K+
P: 8,584
@ChipR
You are quite welcome, ChipR. I was a little concerned about the execution time, but according to you, it really wasn't that significant.
Dec 2 '08 #4

Expert 100+
P: 1,287
I haven't timed it, so I don't want to jump ahead and say that it's fast. My query takes several seconds to display already, so at least I don't notice the extra time. I've tried everything to improve my query, but that will be a topic for another thread.
Dec 2 '08 #5

Post your reply

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