hello can you help me please.. i have this trapping that will trap the characters..but my problem my code is too long..are there other ways to shorten my code..please help me ...hoping for your positive responds...
Public Function mchnotrap(KeyAscii As Integer)
If KeyAscii >= 33 And KeyAscii <= 44 Or KeyAscii = 45 Or KeyAscii = 46 Or KeyAscii = 47 Or KeyAscii = 63 Or KeyAscii = 64 Then
KeyAscii = 0
MsgBox "Invalid input only numbers and letters are allowed", vbInformation, "Invalid, Input...Input Again merchandise number"
Exit Function
End If
If KeyAscii >= 58 And KeyAscii <= 62 Or KeyAscii >= 91 And KeyAscii <= 96 Then
KeyAscii = 0
MsgBox "Invalid, input only numbers and letters are allowed", vbInformation, "Invalid Input...Input Again merchandise number"
Exit Function
End If
If KeyAscii >= 123 And KeyAscii <= 127 Then
KeyAscii = 0
MsgBox "Invalid, input only numbers and letters are allowed ", vbInformation, "Invalid Input...Input Again merchandise number"
Exit Function
End If
End Function
Private Sub txtmchno_KeyPress(KeyAscii As Integer)
Call mchnotrap(KeyAscii)
End Sub