1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Option Compare Database
Option Explicit
Private Sub txtPercent_AfterUpdate()
Dim sgnPercentValue As Single
sgnPercentValue = txtPercent / 100
txtPercent = Format(sgnPercentValue, "0 %") 'Mettre 0.00 % si décimal
End Sub
Private Sub txtPercent_BeforeUpdate(Cancel As Integer)
Dim sgnPercentValue As Single
sgnPercentValue = txtPercent.Text
If sgnPercentValue > 100 Then
MsgBox "Valeur entre 1 et 100 !!", 48
Cancel = True
End If
End Sub
Private Sub txtPercent_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 8, 44, 45, 48 To 57
Case Else
KeyAscii = 0
End Select
End Sub |
Partager