No not working.
No not working.
Doesn't work because the variable LogonAttempts is reset to 0 for each click of the button. Must declare the variable in the module header:
Option Compare Database
Option Explicit
Dim LogonAttempts As Integer
Then change end of the procedure to:Code:'Check to see if data is entered into the UserName combo box LogonAttempts = LogonAttempts + 1 If Me.TXTPASSWORD.Value = DLookup("strEmpPassword", "tblEmployees", _ "[lngEmpID]=" & Me.cboemployee.Value) Then lngMyEmpID = Me.cboemployee.Value 'Close logon form and open splash screen DoCmd.Close acForm, "Logon", acSaveNo DoCmd.OpenForm "switchboard" Else If LogonAttempts = 3 Then MsgBox "You do not have access to this database.Please contact admin.", _ vbCritical, "Restricted Access!" Application.Quit Else MsgBox "Password Invalid. Please Try Again", vbOKOnly, _ "Invalid Entry!" Me.TXTPASSWORD.SetFocus End If End If
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yes now working.
But the other problem is still exist.
That before login I should not have permission to go inside database.
Bcoz the login splash screen still on the screen and I didn't signed in but still I can go inside database.
All I can do is refer you back to posts #8 and 10.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Now another problem occur.
If Password mismatch three times then it work and close the database.
But if User and Password match then this error come which I attached in Pic.
That does not happen in the db I have.
You need to learn how to debug code. Refer to the link at bottom of my post.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Solved Now. Thanks
I feeling shy to ask again and again but really I didn't get this post no. 8 and 10.