I'm sure someone will have a simple solution to this.
I am using Access 97,
I want to use a password system on my database. What I have done is create a table with a single field and that field is the password. There will only be one entry in this table.
On my form i have a text box which is bound to the password table so it displays the one record in there. The textbox is not visible. this textbox is called txt_TruePW
I have another textbox on the form which the user uses to enter in their password. If the password they enter matches the password in the textbox txt_TruePW then it opens the Main Menu.
if it doesnt then it pops up a message box saying the usual incorrect entry stuff. what I would like is that if the user has three wrong attempts then it tells them too many wrong attempts and kicks them off the system.
I have the first part sorted where if the password is correct then it lets them through. But if the password is wrong it stop the user after 3 attempts.
here is the code that I am using
Dim stDocName As String
Dim attempt As Integer
attempt = 0
If Me.Text1.Value = Me.txt_TruePW.Value Then
stDocName = "FRM_ToDo"
DoCmd.OpenForm stDocName
DoCmd.Close acForm, "FRM_Pword", acSavePrompt
Else
If attempt < 3 Then
MsgBox "Incorrect password" & (Chr(13)) & (Chr(13)) & "Remember passwords are case sensitive," & (Chr(13)) & _
"ensure that you are entering the password correctly", vbExclamation, "HP Prompt Security"
attempt = attempt + 1
Else
If attempt = 3 Then
MsgBox "Too many failed attempts", vbCritical, "Mission Aborted"
docmd.quit
End If
End If
End If
Thanx in advance
Iddris
I am using Access 97,
I want to use a password system on my database. What I have done is create a table with a single field and that field is the password. There will only be one entry in this table.
On my form i have a text box which is bound to the password table so it displays the one record in there. The textbox is not visible. this textbox is called txt_TruePW
I have another textbox on the form which the user uses to enter in their password. If the password they enter matches the password in the textbox txt_TruePW then it opens the Main Menu.
if it doesnt then it pops up a message box saying the usual incorrect entry stuff. what I would like is that if the user has three wrong attempts then it tells them too many wrong attempts and kicks them off the system.
I have the first part sorted where if the password is correct then it lets them through. But if the password is wrong it stop the user after 3 attempts.
here is the code that I am using
Dim stDocName As String
Dim attempt As Integer
attempt = 0
If Me.Text1.Value = Me.txt_TruePW.Value Then
stDocName = "FRM_ToDo"
DoCmd.OpenForm stDocName
DoCmd.Close acForm, "FRM_Pword", acSavePrompt
Else
If attempt < 3 Then
MsgBox "Incorrect password" & (Chr(13)) & (Chr(13)) & "Remember passwords are case sensitive," & (Chr(13)) & _
"ensure that you are entering the password correctly", vbExclamation, "HP Prompt Security"
attempt = attempt + 1
Else
If attempt = 3 Then
MsgBox "Too many failed attempts", vbCritical, "Mission Aborted"
docmd.quit
End If
End If
End If
Thanx in advance
Iddris