Hi,
Below is the code that limits user's input to letters & digits only (in a TextBox). It works great, however I have 3 text boxes on my form & would like to check them all WITHOUT retyping the same rutine 3 times.
Can you guys let me know how to write all-purpose Sub/Function that will do the same thing for any text box (not just 'Text1'). Go Reusability!!!

As always Thanks for your help.



---------------------------------------------------------
Private Sub Text1_KeyPress(KeyAscii As Integer)

Dim strChar As String

' Accept the key if its a "control character" ...
If KeyAscii < 32 Then
Exit Sub
End If

strChar = Chr$(KeyAscii)

' Accept the key if it's numeric ...
If strChar >= "0" And strChar <= "9" Then
Exit Sub
End If
strChar = UCase$(strChar)

' Accept the key if it's alpha ...

If strChar >= "A" And strChar <= "Z" Then
Exit Sub
End If

' Otherwise, reject the key ...
KeyAscii = 0

End Sub
---------------------------------------------------------