PDA

View Full Version : User Form textbox mismatch



harber95
08-09-2015, 07:13 AM
14114

In this file, there is a user form called "A_Student_Application".

There is a textbox that represents ID.
The id number in the textbox mustn't be identical to the ID in the table on sheet1.
There should be a message that the IDs shouldn't match (the code is meant to be in the button.

Thanks for the help.

mikerickson
08-09-2015, 12:42 PM
I think this will do what you want

Private Sub CommandButton1_Click()
If Len(TextBox3) <> 9 Then
MsgBox "Use a standard ID with exactly 9 digits"
ElseIf IsNumeric(Application.Match(Val(TextBox3.Text), Sheet1.Range("C:C"), 0)) Then
MsgBox "ID already exists"
Else
Unload Me
B_Insert_Grade.Show

Call Sheet1.Last_Name
Call Sheet1.First_Name
Call Sheet1.ID
Call Sheet1.Address
Call Sheet1.City
Rem Call Sheet1.Year
End If
End Sub

harber95
08-10-2015, 12:47 AM
Thanks