Calculated control showing decimal places

B

BrianS

I have a calculated control displaying the result of a
simple calculation using the value in another control and
dividing by 86 ([Forms]![frmAnyForm]![txtBox1]/86). The
control I am displaying the result in is set to a fixed
format with 0 decimal places. The result displays
correctly in the txtbox as a whole number.

My question is, the control is not locked so that users
can manually change the value. When you click in the text
box the whole number changes to the actual calculated
number displaying up to 11 digits to the right of the
decimal. Clicking in the txtbox, it seems to lose all
formatting rules. Anyone know why this is happening and
how to fix so that if a user clicks in the box, the value
stays fixed w/no decimal value displayed? Thanks!
 
R

Rick Brandt

BrianS said:
I have a calculated control displaying the result of a
simple calculation using the value in another control and
dividing by 86 ([Forms]![frmAnyForm]![txtBox1]/86). The
control I am displaying the result in is set to a fixed
format with 0 decimal places. The result displays
correctly in the txtbox as a whole number.

My question is, the control is not locked so that users
can manually change the value. When you click in the text
box the whole number changes to the actual calculated
number displaying up to 11 digits to the right of the
decimal. Clicking in the txtbox, it seems to lose all
formatting rules. Anyone know why this is happening and
how to fix so that if a user clicks in the box, the value
stays fixed w/no decimal value displayed? Thanks!

That is the way the format property works. It affects the display, not the
content and the actual content is shown when you click into the field. You
would need to modify your code that inserts the value to round the result
first instead of relying on the format property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top