Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: userform password

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Connecticut
    Posts
    181
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a userform with a combobox containing 3 names, followed by a textbox (with the passwordchar set w/ a "*"), and a command button. Using all code, how can I have the program close or prompt to re-enter password, if a person enters a wrong password (a different password required for each name).

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following:

    Private Sub CommandButton1_Click()
    If ComboBox1.Value = FirstUser Then
    If TextBox1.Value = FirstUserPassword Then
    Call YourNextMacro
    Else: MsgBox "Wrong Password, Re-enter"
    End If
    ElseIf ComboBox1.Value = SecondUser Then
    If TextBox1.Value = SecondUserPassword Then
    Call YourNextMacro
    Else: MsgBox "Wrong Password, Re-enter"
    End If
    ElseIf ComboBox1.Value = ThirdUser Then
    If TextBox1.Value = ThirdUserPassword Then
    Call YourNextMacro
    Else: MsgBox "Wrong Password, Re-enter"
    End If
    End If
    End Sub

    Code assumes you have combobox1, textbox1, and commandbutton1. Edit it to fit your needs. (I didn't check to see if it works, so post if you have problems).
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Connecticut
    Posts
    181
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That looks like what I'm looking for, thank you very much Al.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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