Consulting

Results 1 to 3 of 3

Thread: User Form textbox mismatch

  1. #1

    User Form textbox mismatch

    Student List VBA Project.xlsm

    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.

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    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

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •