Format number (percent) in textbox

  • Thread starter Thread starter YSK
  • Start date Start date
Y

YSK

Hello,

I've got a textbox and i do want to set its format to 'Percent', in that way
the user will simply type the number (eg: 10 for 10%).

But my problem is the number given by user will be multipled with 100, it
means that if user entered 10% the value in the textbox will be 1000%.

How can I deal with this problem?

Thank in advance

YSK.
 
Use the Before Update event of your textbox to run a single line of code:
Me.txtBoxName = Me.txtBoxName / 100

replacing txtBoxName with the actual name of the textbox. This way when the
user enters 10, it will be automatically be converted (and saved in the
table, if bound) to 0.1, and dispayed as 10%.

HTH,
Nikos
 
Hello,

I really appreciate your help. It's one of pretty good way to deal with my
problem.

I finally found another solution, it's Format(Me.txtBoxName.value, 0.00) &
"%"

I think both of solutions provided are quite useful.

YSK.
 
YSK said:
I've got a textbox and i do want to set its format to 'Percent', in that way
the user will simply type the number (eg: 10 for 10%).

But my problem is the number given by user will be multipled with 100, it
means that if user entered 10% the value in the textbox will be 1000%.


Instead of using the Percent format (which is pretty much
that same as 0.00%), set the text box's Format property to

0.00\%
 
Back
Top