Entry in TextBox formatted as percentage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a text box that is formatted as percentage. When the user
enters a number without the percent symbol, say "12" for example, and moves
the focus elsewhere, it accepts the number as 1200 - it is multiplied by
100%. I know that percentages are typically fractions of 1, so it is
somewhat logical that this should happen. For the user, however, it is a
nuisance - it would be much better if when they entered "12" they got 12%.
Note that MS Excel will do this in fields that are simarily formatted.

Does anyone know a way to make this easier for the user? I mean, the entry
they make is a percentage instead of a whole number without typing the %
symbol?

Thanks
 
There may be an easier way, but this is the way I handled it (in the
AfterUpdate event)
Private Sub txtBox1_AfterUpdate()
'build routine for percents
Me.txtBox1 = Me.txtBox1 / 100
FormatPercent (Me.txtBox1)
End Sub
 

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

Back
Top