FindFirst, NoMatch not Defined

C

Chris Eberhart

Prior to setting a flag on a record, I want to see if a related record has
already been flagged (only one can be flagged at any time). Using FindFirst
and the NoMatch property seem like the ticket, yet I receive the message,
"Method or Data Member not Found.'
I suspect that this has to do with references libraries, but if the
Microsoft DAO 3.6 library, which I have selected, does not work I do not know
where to turn next.

Any ideas on how I can get these methods working? Jsut for yuks, here is
the code:

Dim rs As Recordset
Set rs = db.OpenRecordSet("Link_Documents_SOXControls")

With rs

.FindFirst "Primary = Yes AND DocumentID = " & Forms![Main
Document].DocumentID
If Not .NoMatch Then
MsgBox "A Primary control has already been assigned to this
document. You must clear that before assigning another."
Me.Primary = Me.Primary.OldValue
Else
End If
 
K

Ken Snell [MVP]

You likely have both ADO and DAO libraries seleced, and the ADO library is
probably higher in priority than the DAO library. Thus, your ambiguous Dim
statement:
Dim rs As Recordset

doesn't specify which library to use (both ADO and DAO have Recordset
objects).

Use this instead:
Dim rs As DAO.Recordset

That tells ACCESS that you want a DAO recordset, which is the one that has
FindFirst method and NoMatch property.

If you wanted to use an ADO recordset, then you'd use
Dim rs As ADODB.Recordset
 

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