Recordset.FindFirst argument not working...

H

Hendy88

Hello all! I have the following code and no matter how I change it
around, even though the access table is COMPLETELY empty, it still
seems to think the record exists in my Access Database table and
always kicks off to the MsgBox "Record Found in Table". So either
the .FindFirst isn't working or there another way to rewrite it so it
does work.

Dim AccessDB As Database
Dim AccessRecordSet As Recordset
Dim FindThis As String

Set AccessDB = OpenDatabase("C:\MyDatabase.mdb")
Set AccessRecordSet = AccessDB.OpenRecordset("MyTable",
dbOpenTable)

FindThis = Range("A1").Value

On Error Resume Next
With AccessRecordSet
.FindFirst "[Field1]= '" & FindThis &"'"

If AccessRecordSet.NoMatch Then
MsgBox "Record Not Found in Table"
Else
MsgBox "Record Found in Table"
End If

End With

Again, I've cleared the entire contents of the Access table to test
whether or not the .FindFirst was actually working and it still tells
me that a record WAS found. I'm at a loss.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top