I have a access 2002 database that was handed down to me.. this program does some document control, set up with access rights for different users.
I got into it to clean it up a bit and I've hit a snag. I converted the database from a 2000 to a 2002. Amidst playing around with the Log-In screen somehow my Log In button stopped working; except if you type your password and then hit enter.
Now the Log In button ( cmdLogIn_Click() ) is pointing at the same exact script as the ( txtpassword_KeyDown(KeyCode As Integer, Shift As Integer) ) function.
I don't know any VB and I'm not really familiar with Access, so if anyone could decode this for me I would be really grateful.
Here is the script that those two functions are pointing to:
Private Sub LogIn_Click()
Dim strPassword As String
Dim strPasswordAttempt
txtPassword.SetFocus
strPasswordAttempt = txtPassword.Text
cboUsername.SetFocus
strPassword = DLookup("[Password]", "User", "[Username] = '" & cboUsername.Value & "'")
If strPasswordAttempt = strPassword Then
strUsername = cboUsername.Value
intAccessLevel = DLookup("[AccessLevel]", "User", "[Username] = '" & cboUsername.Value & "'")
bolApprover = DLookup("[Approver]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditDocumentInfo = DLookup("[EditDocumentInfo]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditUserInfo = DLookup("[EditUserInfo]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditReferenceDocuments = DLookup("[EditReferenceDocuments]", "User", "[Username] = '" & cboUsername.Value & "'")
bolViewAllApprovers = DLookup("[ViewAllApprovers]", "User", "[Username] = '" & cboUsername.Value & "'")
bolDocumentControl = DLookup("[DocumentControl]", "User", "[Username] = '" & cboUsername.Value & "'")
' MsgBox "Your access level is " & intAccessLevel
Startup ' run startup sub
DoCmd.OpenForm "Welcome", acNormal
DoCmd.Close acForm, "Login"
LogEvent strUsername, Now(), "Login Successful", "Network Username: " & strNetworkUserName & " on Computer " & strComputerName
'LogEvent strUsername, Now(), "Login Successful", " on Computer " & strComputerName
Else
MsgBox "That password is incorrect. Try again."
LogEvent "Unknown", Now(), "Login Failed", "Attempt: " & CStr(cboUsername.Value) & " , " & strPasswordAttempt & " Network UserName: " & strNetworkUserName & " on computer " & strComputerName
End If
End Sub
When you click the Log In button it does actually run the script, but it gives me the "The password is incorrect. Try again." message even if the password is correct. I can just click into the txtpassword box and hit enter and it will log me into the database.
P.S. I say again, this isn't my code.. its probably super ugly, but I cant' tell
I got into it to clean it up a bit and I've hit a snag. I converted the database from a 2000 to a 2002. Amidst playing around with the Log-In screen somehow my Log In button stopped working; except if you type your password and then hit enter.
Now the Log In button ( cmdLogIn_Click() ) is pointing at the same exact script as the ( txtpassword_KeyDown(KeyCode As Integer, Shift As Integer) ) function.
I don't know any VB and I'm not really familiar with Access, so if anyone could decode this for me I would be really grateful.
Here is the script that those two functions are pointing to:
Private Sub LogIn_Click()
Dim strPassword As String
Dim strPasswordAttempt
txtPassword.SetFocus
strPasswordAttempt = txtPassword.Text
cboUsername.SetFocus
strPassword = DLookup("[Password]", "User", "[Username] = '" & cboUsername.Value & "'")
If strPasswordAttempt = strPassword Then
strUsername = cboUsername.Value
intAccessLevel = DLookup("[AccessLevel]", "User", "[Username] = '" & cboUsername.Value & "'")
bolApprover = DLookup("[Approver]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditDocumentInfo = DLookup("[EditDocumentInfo]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditUserInfo = DLookup("[EditUserInfo]", "User", "[Username] = '" & cboUsername.Value & "'")
bolEditReferenceDocuments = DLookup("[EditReferenceDocuments]", "User", "[Username] = '" & cboUsername.Value & "'")
bolViewAllApprovers = DLookup("[ViewAllApprovers]", "User", "[Username] = '" & cboUsername.Value & "'")
bolDocumentControl = DLookup("[DocumentControl]", "User", "[Username] = '" & cboUsername.Value & "'")
' MsgBox "Your access level is " & intAccessLevel
Startup ' run startup sub
DoCmd.OpenForm "Welcome", acNormal
DoCmd.Close acForm, "Login"
LogEvent strUsername, Now(), "Login Successful", "Network Username: " & strNetworkUserName & " on Computer " & strComputerName
'LogEvent strUsername, Now(), "Login Successful", " on Computer " & strComputerName
Else
MsgBox "That password is incorrect. Try again."
LogEvent "Unknown", Now(), "Login Failed", "Attempt: " & CStr(cboUsername.Value) & " , " & strPasswordAttempt & " Network UserName: " & strNetworkUserName & " on computer " & strComputerName
End If
End Sub
When you click the Log In button it does actually run the script, but it gives me the "The password is incorrect. Try again." message even if the password is correct. I can just click into the txtpassword box and hit enter and it will log me into the database.
P.S. I say again, this isn't my code.. its probably super ugly, but I cant' tell
