I have three command buttons which when clicked on open different forms. These forms are first password protected with a custom password form
I would like to implement a function so that if the incorrect password is typed in 3 times then it does something like exits the program.
Can anyone help / point me to an example that i can apply to my code..
Thanks
Here is the code for my check password cmd button.
Dim strInput As String
Dim strMsg As String
strInput = txt_Password
strMsg = "This form Password Protected. Please Enter The Correct Password."
Select Case intFormOpen
Case 1
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_AddNew", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
Case 2
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_Edit", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
Case 3
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_Delete", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
End Select
I would like to implement a function so that if the incorrect password is typed in 3 times then it does something like exits the program.
Can anyone help / point me to an example that i can apply to my code..
Thanks
Here is the code for my check password cmd button.
Dim strInput As String
Dim strMsg As String
strInput = txt_Password
strMsg = "This form Password Protected. Please Enter The Correct Password."
Select Case intFormOpen
Case 1
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_AddNew", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
Case 2
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_Edit", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
Case 3
If strInput = "123profile" Then 'password is correct
DoCmd.Close acForm, "Frm_Password"
DoCmd.OpenForm "Frm_Delete", acNormal, "", "", , acDialog
Else 'password is incorrect
MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Try agian"
Exit Sub
End If
End Select