please help me out in wat could be the error in the below code as it is not running when it comes down to the openrecordset statement!
Private Sub cmdOK_Click()
Dim rst As DAO.Recordset
'check for null password
If IsNull(Trim(userid)) Then
MsgBox "User Name required.", vbExclamation
userid.SetFocus
Exit Sub
End If
'check for null password
If IsNull(Trim(pswd)) Then
MsgBox "Password required.", vbExclamation
pswd.SetFocus
Exit Sub
End If
Dim tempRecordSet As Recordset
Dim Password As String
Set tempRecordSet = rst.OpenRecordset("select * from Login where userid = '" & userid.Text & "'")
If tempRecordSet.RecordCount <> 0 Then
Password = UCase(Trim(tempRecordSet("Password")))
End If
tempRecordSet.Close
Set tempRecordSet = Nothing
If Password <> UCase(Trim(pswd)) Then
MsgBox "Incorrect password", vbExclamation
Else
MsgBox "Congratulations! Right Password!!!", vbExclamation
End If
pswd = Empty
End Sub
thankx a lot! please help as soon as possible!