Hi there,
I've got a minor problem and it is doing my head in. I've spent several hours searching the web for an answer but I've come up dry.
What I am trying to do is create a form which asks for a password. If the password is entered incorrectly then the user gets 3 more tries after which a torrent of abuse is hurled at them. Or something.
Now, the userform and password check is easy peasy but the thing that is frustrating the CRAP out of me is getting the loop to work correctly.
The problem I am having is that the message box won't disappear and let the user have another go at entering the password and I can't figure out why. I've tried password.setfocus (it is a textbox control) and userform.hide / userform.show but nothing seems to work correctly.
Any thoughts on what I am doing wrong? It isn't vital but it is very bloody irritating not to be able to get it to work.
Kind regards,
Splatgore
I've got a minor problem and it is doing my head in. I've spent several hours searching the web for an answer but I've come up dry.
What I am trying to do is create a form which asks for a password. If the password is entered incorrectly then the user gets 3 more tries after which a torrent of abuse is hurled at them. Or something.
Now, the userform and password check is easy peasy but the thing that is frustrating the CRAP out of me is getting the loop to work correctly.
Code:
Private Sub confirm_Click()
Dim Response As String
Dim Check As String
Dim Tries As Long
Check = "blah"
i = 0
StartLoop:
Do While i < 3
If Response <> Check Then
MsgBox "Incorrect Password! Security are on their way!"
i = i + 1
GoTo StartLoop
Else
MsgBox "Hmm...lucky guess! I guess you can carry on...!"
Call Do_Stuff
End If
Loop
End Sub
The problem I am having is that the message box won't disappear and let the user have another go at entering the password and I can't figure out why. I've tried password.setfocus (it is a textbox control) and userform.hide / userform.show but nothing seems to work correctly.
Any thoughts on what I am doing wrong? It isn't vital but it is very bloody irritating not to be able to get it to work.
Kind regards,
Splatgore