Hello,
The following routines take place for the KeyPress and LostFocus event. These routines must be replicated for 28 text boxes. Apart from the name of the textbox, all else remains identical. Is there some way I can call a function in the event rather than pasting the code 28 times?
Private Sub Text10_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Is = 119
Exit Sub
Case Is > 69
MsgBox ("You Can Only Enter Letters B,C,D,E,U or W")
End Select
End Sub
Private Sub Text10_LostFocus()
If BadKey = True Then
Text10.Text = ""
ElseIf Len(Me.Text10.Text) > 1 Then
MsgBox ("ONLY B,C,D,E,U and W ARE VALID")
Text10.Text = ""
End If
BadKey = False
End Sub
many thanks............
The following routines take place for the KeyPress and LostFocus event. These routines must be replicated for 28 text boxes. Apart from the name of the textbox, all else remains identical. Is there some way I can call a function in the event rather than pasting the code 28 times?
Private Sub Text10_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Is = 119
Exit Sub
Case Is > 69
MsgBox ("You Can Only Enter Letters B,C,D,E,U or W")
End Select
End Sub
Private Sub Text10_LostFocus()
If BadKey = True Then
Text10.Text = ""
ElseIf Len(Me.Text10.Text) > 1 Then
MsgBox ("ONLY B,C,D,E,U and W ARE VALID")
Text10.Text = ""
End If
BadKey = False
End Sub
many thanks............