HI I have a login form on which I have an Ok button and what I am trying to do is match the user ID on the login form with the User ID in the tblUser. and also Password on the login form with Password in the table. If both matches I am trying to make few fields visible to few people. But I am getting Error 13 Type Mismatch.
Here is my code
Private Sub cmd_Ok_Click()
'Check that EE is selected
If IsNull(Me.cboUser) Then
MsgBox "You need to select a user!", vbCritical
Me.cboUser.SetFocus
Else
'Check for correct password
If Me.txtPassword = Me.cboUser.column(2) Then
'Check if password needs to be reset
If Me.cboUser.column(3) = True Then
DoCmd.OpenForm "frmPasswordChange", , , "[UserID] = " & Me.cboUser
End If
DoCmd.OpenForm "frmHomePage"
Me.Visible = False
Dim X As Integer
X = Nz(DLookup("UserID", "tblUser", "UserID='" & cboUser.column(0) & "'" And "Password='" & txtPassword & "'"))
If X = 57 Then
Forms!Formname!comboname.Visible = False
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If
End If
End If