Hi everyone,
I am really stumped here and I am not sure how to make this work.
If my password is correct, it works fine. If the password is incorrect, it shows the MsgBox and then cycles through the loop until the count is 4 and exits.
I can not set it to allow me to re-enter another password.
Thanks in advance for looking!
Here is my code:
Dim Var1 As Integer
If Me.txtPassword.Value <> DLookup("Password", "Analysts", _
"[Employee_ID]=" & Me.cboEmployee.Value) Then
Do While Var1 < 4
MsgBox "Password Invalid. Please Try Again", vbExclamation, _
"Invalid Entry!"
Var1 = Var1 + 1
MsgBox "Password Attempts = " & Var1, vbInformation
If Var1 <= 2 Then
Me.txtPassword.SetFocus
Else
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
Loop
Else
lngMyEmpID = Me.cboEmployee.Value
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMenu"
End If
I am really stumped here and I am not sure how to make this work.
If my password is correct, it works fine. If the password is incorrect, it shows the MsgBox and then cycles through the loop until the count is 4 and exits.
I can not set it to allow me to re-enter another password.
Thanks in advance for looking!
Here is my code:
Dim Var1 As Integer
If Me.txtPassword.Value <> DLookup("Password", "Analysts", _
"[Employee_ID]=" & Me.cboEmployee.Value) Then
Do While Var1 < 4
MsgBox "Password Invalid. Please Try Again", vbExclamation, _
"Invalid Entry!"
Var1 = Var1 + 1
MsgBox "Password Attempts = " & Var1, vbInformation
If Var1 <= 2 Then
Me.txtPassword.SetFocus
Else
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
Loop
Else
lngMyEmpID = Me.cboEmployee.Value
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMenu"
End If