You can use Mid() , Left() or Right() function to get The first four characters and the last 3 characters and Use Len() for the length of text.
Jx_Man
Senior Poster
3,553 posts since Nov 2007
Reputation Points: 1,500
Solved Threads: 531
Skill Endorsements: 65
This how far i'm doing. But i don't know how to check if last 3 character is number?
Use IsNumeric() function :
Private Sub Command1_Click()
Dim First4Char, Last3Char As String
First4Char = Mid(Text1.Text, 1, 4)
Last3Char = Mid(Text1.Text, 5, 7)
If Len(Text1.Text) <= 7 Then
If First4Char <> "ABCD" Then
MsgBox "Wrong"
Else
If Not IsNumeric(Last3Char) Then
MsgBox "Wrong Input"
Else
' Action if text is accepted
End If
End If
End If
End Sub
Jx_Man
Senior Poster
3,553 posts since Nov 2007
Reputation Points: 1,500
Solved Threads: 531
Skill Endorsements: 65
Question Answered as of 1 Year Ago by
Jx_Man