number formatting in a locked text box...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

I have a subform that has some locked text boxes that are used to display
calculated values... The text boxes themselves are formatted as "Currency"
with two decimal places...

If the user clicks into the text box (even though it is locked) all of a
sudden the number shows with about 8 decimal places...

What is the simplest way to prevent this from happening? Should I use a
label instead or use the round function when I set the value in there in the
first place?

Thanks,

Brad
 
Brad Pears said:
I have a subform that has some locked text boxes that are used to display
calculated values... The text boxes themselves are formatted as "Currency"
with two decimal places...

If the user clicks into the text box (even though it is locked) all of a
sudden the number shows with about 8 decimal places...

What is the simplest way to prevent this from happening? Should I use a label
instead or use the round function when I set the value in there in the first
place?

If you set Enabled = False as well then they will not be able to click into the
control.
 
Brad said:
I have a subform that has some locked text boxes that are used to display
calculated values... The text boxes themselves are formatted as "Currency"
with two decimal places...

If the user clicks into the text box (even though it is locked) all of a
sudden the number shows with about 8 decimal places...

What is the simplest way to prevent this from happening? Should I use a
label instead or use the round function when I set the value in there in the
first place?


Part of the issue is that when a text box receives the
focus, it must display the original data (not just a
formatted view of the data) so you can edit it.

If the text box were bound to a data field of type
Currenecy, instead of Single or Double, then the formatted
view of the data would be much closer to the actual data,
the two views would probably be the same (except for the $
sign).

If you don't want to allow them to click into the box, then
you should also set the text boxes to be disabled. The
control will appear the same but it won't be able to receive
the focus so it won't try to display the unformatted value.
 
Back
Top