By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,451 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

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

P: 1
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

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

Expand|Select|Wrap|Line Numbers
  1.   If txtpassword.Value = DLookup("[pswrd]", "tbllogin", "[cbousername] =" & Me.Cbousername.Value) Then
  2.         DoCmd.Close
  3.         DoCmd.OpenForm ("frmmain")
  4.     Else
  5.         intmsg = MsgBox("Invalid Password. Choose your user name and enter a valid password!", vbOKOnly + vbCritical, "Login")
  6.         Me.txtpassword.SetFocus
  7.         Me.txtpassword.Text = ""
  8.  End If
Oct 26 '13 #1
Share this Question
Share on Google+
1 Reply


RuralGuy
Expert 100+
P: 375
My guess is your password is a string value so it needs to be enclosed within single quotes inn this case:
Expand|Select|Wrap|Line Numbers
  1. If txtpassword.Value = DLookup("[pswrd]", "tbllogin", "[cbousername] ='" & Me.Cbousername.Value & "'") Then
Oct 27 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.