Private Sub Text1_KeyPress(KeyAscii As Integer) Dim strValid As String If KeyAscii = 13 Then If Len(txtNo.Text) = 6 Then SendKeys "{Tab}" KeyAscii = 0 End If strValid = "abcdefghijklmnopqrstuvwxyz" & _ Chr(vbKeyBack) & "ABCDEFGHIJKLMNOPQRSTUVWXYZ" If InStr(strValid, Chr(KeyAscii)) = 0 Then KeyAscii = 0 End IfEnd Sub
If Len(txtNo.Text) = 6 Then SendKeys "{Tab}"
KeyAscii = 0
End If strValid = "abcdefghijklmnopqrstuvwxyz" & _
Chr(vbKeyBack) & "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End IfEnd Sub