I’m running the below code on MS Access 2000 and I’m getting Run-time error '13' Type mismatch,
the line >Set rsT_Users = CurrentDb.OpenRecordset(StrSQL, dbOpenSnapshot)< highlighted in yellow.
the same code worked for me on another DB, I don’t know whats wrong could anyone help please.
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Option Explicit
- Dim intLoginFails
- ---------------------------------------
- Private Sub cmdLogin_Click()
- Dim rsUsers As Recordset
- Dim StrSQL As String
- StrSQL = ""
- txtUserID.SetFocus
- StrSQL = "Select * From [Users] Where [Users].[UserID]='" & txtUserID & "'"
- txtPassword.SetFocus
- StrSQL = StrSQL + " AND [Users].[Password]='" & txtPassword & "'"
- Set rsUsers = CurrentDb.OpenRecordset(StrSQL, dbOpenSnapshot)
- If rsUsers.EOF Then
- intLoginFails = intLoginFails + 1
- If intLoginFails > 3 Then
- MsgBox "You have exceeded then number of attempts"
- DoCmd.Quit
- End If
- MsgBox "Invalid User Name Or Password"
- Else
- MsgBox "Correct user Name and Password"
- End If
- End Sub