Still Not Checkign the password

rgag
rgag used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
The only thing I can see is that your trimming the textbox but not the returning recordset result.  Perhaps if you trim both they will match?

G
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...
Author of the Year 2009

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial