Mollethewizard
IS-IT--Management
I have a minor problem. How can I prevent a user from exiting a textbox in a user form if the entry is not correct, in this case anything but numbers?
In the textbox key-press event I’ve written some code that give the user a message – but how on earth can I give the textbox focus again?
The code goes like this:
Private Sub txtKronor_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii >= 48 And KeyAscii <= 57 Then
Else
KeyAscii = 0
Meddelande = MsgBox("Ogiltig inmating - se Makroanvisningar", 48, "Ogiltig inmatning"
With frmDodsbo.txtKronor
.Value = ""
End With
End If
End Sub
Any help would be much appreciated
Mollethewizard
In the textbox key-press event I’ve written some code that give the user a message – but how on earth can I give the textbox focus again?
The code goes like this:
Private Sub txtKronor_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii >= 48 And KeyAscii <= 57 Then
Else
KeyAscii = 0
Meddelande = MsgBox("Ogiltig inmating - se Makroanvisningar", 48, "Ogiltig inmatning"
With frmDodsbo.txtKronor
.Value = ""
End With
End If
End Sub
Any help would be much appreciated
Mollethewizard