you could try the following:

Private Sub CommandButton1_Click()
'validate username / password
Dim IncorrectCounter as string
IncorrectCounter = Range("userDB!d2").value

If IncorrectCounter < 3 then
' (user1)
If Range("userDB!b2") = txtLogin.Value And Range("userDB!c2") = txtPassword.Value Then
UserForm2.Show
else
MsgBox ("Incorrect Login and/or Password")
IncorrectCounter = IncorrectCounter + 1
Range("userDB!d2").value = IncorrectCounter
End If
else
MsgBox ("Cannot Try more than 3 logins")
'put the rest of code..to shut down log in procedure.

end if

End Sub