Entry in TextBox formatted as percentage

L

lwert

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
 
D

Damon Heron

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
 
Top