% format

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

Guest

Hello.
I have a field which I want to enter e.g. '20' and I want to show '20,00%'.
I already tried to format it to Percentage, but everytime I enter '20'
apears '2000,00%'. How can I do this?
Thank you.
Acores
 
acores said:
Hello.
I have a field which I want to enter e.g. '20' and I want to show
'20,00%'. I already tried to format it to Percentage, but everytime I
enter '20' apears '2000,00%'. How can I do this?
Thank you.
Acores

The percent format is assumed to be applied to a decimal fraction, so if
you entered ",20" you would get "20%" (or "20,00%", if you have
specified two decimal places).

If you don't want to force users to enter decimal fractions, you could
use the AfterUpdate event for the text box to change their entry by
dividing it by 100. For example,

'----- start of example code -----
Private Sub txtPercent_AfterUpdate()

If Me.txtPercent > 1,00 Then
Me.txtPercent = Me.txtPercent / 100
End If

End Sub
'----- end of example code -----
 
Back
Top