Help with Password and Username match

ecu97wedge4

New member
Local time
Today, 04:05
Joined
Aug 13, 2013
Messages
3
HELP please....I have gotten to the bitter end of this but cannot get this run smooth:banghead:.... I know this problem is within the DLookUp line.

In my tblMember I do have a column with ID....I just cant get the DLookup to match the username and password then OPEN the navigation screen.
So here is the code

How do I get it to recognize the name in cboMember and then recognize the 4digits in txtPassword as a match from tblMember or qryPassword....then if they do match open the form frmNavigation.
If they DONT match then reply with MsgBox and statement saying Invalid.

The query called qryPassword pulls Member and Password if this would be helpful.


Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboMember) Or Me.cboMember = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboMember.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblMember to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "tblMembers" _
& Me.cboMember.Value) Then

'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogin", acSaveNo
DoCmd.OpenForm "frmNavigation"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtPassword.SetFocus
End If

End Sub
 
Try:
DLookup("Password", "tblMembers", "MemberID = " & Me.cboMember)
 
Fyi I moved your thread to a more appropriate forum.
 

Users who are viewing this thread

Back
Top Bottom