I am creating a login routine that will check the username and password in table. I have managed to get it to work. The problem is i have used the .Find method to find the Username, if the username exists in the database and the password is the same in the record it will login, however, if the username is incorrect then and error message is generated (See below). Is there a more efficient way to create a login routine for this database via VB? Otherwise, how would i check to see if the username is actually in the database?
Error
Quote:
Run-time error '3021':
Either BOF or EOF is true, or the current record has been deleted. Requested operation requires a current record.
Regards,Code:Private Sub Command1_Click()
With adoRecordSet
If .EOF Or .BOF Then
.MoveFirst
.MoveNext
Else
' What if the Username is incorrect?
.Find "Username = '" & Text1.Text & "'", , adSearchForward
If Text2.Text = .Fields("Password") Then
strUsername = Text1.Text
Form2.Show
Unload Me
Else
MsgBox "The Username and / or Password is incorrect. Please" & vbCrLf _
& "try again.", vbExclamation, "Login Error"
End If
End If
End With
End Sub
Jenova
