Private Sub YourControlNameHere_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 9 ' tab key
' let it through
Case 48 To 57
' let it through
Case 96 To 105
' let it through
Case Else
' cancel the key stroke
KeyCode = 0
End Select
If Len(Me.YourControlNameHere.Text) >= 4 Then
' cancel the stroke if we've reached 4 characters
KeyCode = 0
End If
End Sub