This code is used to validate the number of times a user tries to enter the password.On invalid pas
This code is used to validate the number of times a user tries to enter the password.On invalid password received as input more than 3
Rate This code is used to validate the number of times a user tries to enter the password.On invalid pas
(1(1 Vote))
If txtpwd.Text = "" Then 'textbox for entering the password value(change name to txtpwd)
MsgBox "Please enter a value"
txtpwd.setfocus
Else
Call pwd
End If
End Sub
Sub pwd()'procedure for password validation
Static cnt As Integer
cnt = cnt + 1
strpwd = txtpwd.Text
substring = Trim(strpwd)'to trim spaces
If cnt > 3 Then 'to check if the user has tried not more than 3 times
MsgBox Prompt:=("Sorry , your ID is locked")
End
End If
If strpwd <> "password" Or substring = "" Then
MsgBox Prompt:="Invalid password.Try again"
txtpwd.setfocus
Else
MsgBox Prompt:="Login successful!"
frmExit.Show 'This may vary depending on the action required
End If
End Sub
Private Sub Form_Load()
txtpwd.PasswordChar = "*" 'the format of password character
End Sub
This code is used to validate the number of times a user tries to enter the password.On invalid pas Comments
No comments yet — be the first to post one!
Post a Comment