Link to home
Start Free TrialLog in
Avatar of rgag
rgag

asked on

Still Not Checkign the password

I have tried everyone's suggestion and still cannot get this program to log people in. Can soemone please look at the code and help me. I have an adocontrol called adopassword which connects to the pestbegone database and I am pullign the employees from the tblsales table and the SalesPerson field. The password is from the Password field.

Any help would be greatly appreciated,

Ryan Gagliano

Option Explicit
'Set a reference to:
'Microsoft ActiveX data object (highest version) library
Public LoginSucceeded As Boolean

Private Sub cmdCancel_Click()
    'set the global var to false
    'to denote a failed login
    LoginSucceeded = False
    Me.Hide
End Sub
Private Sub Form_Load()
   'connect do Db
        adoPassword.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                    "Data Source=" & App.Path & "\Pestbegone.mdb;" & _
                                    "Persist Security Info=False"
        adoPassword.RecordSource = "tblsales"
        adoPassword.Refresh

End Sub

Private Sub cmdOK_Click()

    'check for correct password

     LoginSucceeded = False
   
    If Len(Trim(txtPassword.Text)) > 0 Then
       adoPassword.Recordset.Find "SalePerson = '" & dcboEmployee.Text & "'", , , adBookmarkFirst
       If adoPassword.Recordset.Fields("Password") = Trim(txtPassword.Text) Then
           LoginSucceeded = True
           Me.Hide
       Else
           'pwd is incorrect
           MsgBox "Invalid Password, try again!", , "Login"
           LoginSucceeded = False
           txtPassword.SetFocus
           SendKeys "{Home}+{End}"
       End If
   Else
       MsgBox "Enter a Password", , "Login"
       txtPassword.SetFocus
       LoginSucceeded = False
       SendKeys "{Home}+{End}"
   End If



If LoginSucceeded = True Then

Load frmCustInfo
frmCustInfo.Show

End If

End Sub
ASKER CERTIFIED SOLUTION
Avatar of Glowman
Glowman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Crazy_king_in
Crazy_king_in

Yeah thats correct, you are trimming only the password text and not the password from the recordset.
Also if required u can change the case and also check it
Good Luck...
Avatar of DanRollins
Hi rgag,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Glowman's comment(s) as an answer.

rgag, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer