Solved: Login /  Password validation - limited attempts?
	
	
		Hey all,
I have some basic code, that requires users to input a login and password, to use certain parts of an application. It works just fine, but I am wondering it there is a way to only allow a limited amount of tries (maybe 3?) and if they incorrectly input info 3 times, it will kick them out, or notify some1 etc.
 
Here is the vba I am using to validate the user :
 
[VBA]
Private Sub CommandButton1_Click()
'validate username / password
 
' (user1)
If Range("userDB!b2") = txtLogin.Value And Range("userDB!c2") = txtPassword.Value Then
UserForm2.Show
Else: MsgBox ("Incorrect Login and/or Password")
End If
 
(user2)
[ code repeats its self for user 2]
End Sub
[/VBA] 
 
Also, is it possible to loop through the users rather than me tryping if/then's for each user? Thanks in advance.