trouble with log in script (1 Viewer)

DanKe

New member
Local time
Today, 13:28
Joined
Apr 5, 2007
Messages
3
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 :eek:
 

DanKe

New member
Local time
Today, 13:28
Joined
Apr 5, 2007
Messages
3
Update

Ok, I've figured out why its not letting me Login with the button.

When I got this there was no input mask on the password input box- so I decided to throw one on there. Now whenever I take that input mask off, it runs fine. I don't know how to do the work around though. I'm guessing it's pulling directly from the text box and its seeing the password as literally a bunch of *'s.
I'm also guessing that maybe you can't put a input mask on a password box.

Is this true - do I have to do a bit of recoding on this, or is there just something I'm missing?
 

boblarson

Smeghead
Local time
Today, 11:28
Joined
Jan 12, 2001
Messages
32,059
You should be able to use a password mask. Did you put the mask in as:

Password

or did you use

*****
 

DanKe

New member
Local time
Today, 13:28
Joined
Apr 5, 2007
Messages
3
the input mask on the password box is set as "Password"

It ran me through the little input mask wizard, and I chose Password.

Its weird though.. Why would it be reading as *'s? When I check the access log that is set up in it this is what it reads:

Attempt: dane , ******** Network UserName: on computer

now from the code on this thing
LogEvent "Unknown", Now(), "Login Failed", "Attempt: " & CStr(cboUsername.Value) & " , " & strPasswordAttempt & " Network UserName: " & strNetworkUserName & " on computer " & strComputerName

it grabs the username inputed, then the password string, continuing logging the User's "network name".

Can anyone make sense of why its pulling the password box as *'s?
 

Users who are viewing this thread

Top Bottom