ecu97wedge4
New member
- Local time
- Today, 12:43
- Joined
- Aug 13, 2013
- Messages
- 3
Help with Password and Username match
HELP please....I have gotten to the bitter end of this but cannot get this run smooth.... 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.
Right now it is saying Run time error '3464':
Data type mismatch in criteria expression.
I looked to see if all boxes were set to TEXT and they were.
SO PLEASE HELP....HELP...HELP
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", "ID =" & 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
HELP please....I have gotten to the bitter end of this but cannot get this run smooth.... 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.
Right now it is saying Run time error '3464':
Data type mismatch in criteria expression.
I looked to see if all boxes were set to TEXT and they were.
SO PLEASE HELP....HELP...HELP
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", "ID =" & 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