when using the dlookup command, only the first password situated on the top of the ta

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Larvish
    New Member
    • Oct 2013
    • 1

    when using the dlookup command, only the first password situated on the top of the ta

    I have tried the followig codes form my logon form but for all the usernames that has been seted, only the first password in the table that allows the logon all the other passwords give on error.... help

    ............... ............... ............... ............... .

    Code:
      If txtpassword.Value = DLookup("[pswrd]", "tbllogin", "[cbousername] =" & Me.Cbousername.Value) Then
            DoCmd.Close
            DoCmd.OpenForm ("frmmain")
        Else
            intmsg = MsgBox("Invalid Password. Choose your user name and enter a valid password!", vbOKOnly + vbCritical, "Login")
            Me.txtpassword.SetFocus
            Me.txtpassword.Text = ""
     End If
    Last edited by Rabbit; Oct 26 '13, 09:21 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • RuralGuy
    Recognized Expert Contributor
    • Oct 2006
    • 375

    #2
    My guess is your password is a string value so it needs to be enclosed within single quotes inn this case:
    Code:
    If txtpassword.Value = DLookup("[pswrd]", "tbllogin", "[cbousername] ='" & Me.Cbousername.Value & "'") Then

    Comment

    Working...