Results 1 to 4 of 4

Thread: Password Expiry - 3 Strikes Then Out

  1. #1

    Exclamation Password Expiry - 3 Strikes Then Out



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello,

    I need an expert to solve my problem.

    I have login userform, which when user key in wrong password (3 times in a rows), a message will appear and close login userform.

    Here the code of enter button:

    Code:
    Private Sub EnterPassword_Click()
    Dim password As StringDim x As Integerpassword = PasswordInput.TextIf password = WorksheetFunction.VLookup(UserList.Value, Range("Users_List"), 2, 0) ThenMsgBox "Password Accepted"Unload MeWorksheets("PCList").Visible = xlSheetVisibleSheets("PCList").SelectWorksheets("Main Page").Visible = xlSheetVeryHiddenActiveSheet.Range("$A$9:$K$1048576").AutoFilter Field:=11Worksheets("Blank").Visible = xlSheetVeryHiddenElse For x = 1 To 3If x < 3 ThenMsgBox "Unsuccessfull!"Next x ElseIf x = 3 ThenMsgBox "Sorry, 3 strikes you're out.", 16, "Cannot continue; incorrect password not given."End IfExit SubEnd If
    End Sub


    I attach an interface of login form for your references.
    I appreciate your help on this.

    Thanks a lot. http://www.excelforum.com/attachment...4&d=1342692981



  2. #2
    Can't download your attachment

  3. #3
    Quote Originally Posted by nevadaDave View Post
    Can't download your attachment
    I'm sorry. It's not an attachment but just link to view the image

  4. #4
    Option Explicit
    Public x As Integer


    Private Sub loginUserForm_Initialize()
    x = 1
    enterPassword.Caption = "Enter Password, " & x
    End Sub


    Private Sub enterPassword_Click()


    Dim password As String
    password = PasswordInput.Text
    If password = WorksheetFunction.VLookup(UserList.Value, Range("Users_List"), 2, 0) Then
    MsgBox "Password Accepted"
    Unload Me
    Worksheets("PCList").Visible = xlSheetVisible
    Sheets("PCList").Select
    Worksheets("Main Page").Visible = xlSheetVeryHidden
    ActiveSheet.Range("$A$9:$K$1048576").AutoFilter Field:=11
    Worksheets("Blank").Visible = xlSheetVeryHidden
    Else:
    If x < 3 Then
    MsgBox "Unsuccessfull" & "try number " & x
    x = x + 1
    enterPassword.Caption = "Enter Password, " & x
    PasswordInput.Text = ""
    ElseIf x = 3 Then
    MsgBox "Sorry, 3 strikes you're out.", 16, "Cannot continue; incorrect password not given."
    Me.Hide
    Unload Me
    End If
    Exit Sub
    End If
    End Sub

Posting Permissions

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