.NoMatch Compile Error

H

Helen

I have a problem in Access2002 where the .NoMatch
property will not compile. This can be reproduced on a
simple db as follows:

Public Sub test()

Dim db As DAO.Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("table1")

With rec

..Index = "PrimaryKey"

..Seek "=", "1234"

If Not .NoMatch Then
Debug.Print rec![test]
End If

End With

End Sub

The above will not compile although NoMatch is listed in
the DAO 3.6 library.

Any ideas?

Many thanks,
 
T

Tony C

In your References, are you specifying ActiveX Data
Objects Libraries? If you are then de-select these
libraries then try again.

Tony C
 
T

Tim Ferguson

.Index = "PrimaryKey"

.Seek "=", "1234"

If Not .NoMatch Then
Debug.Print rec![test]
End If

I don't use the .Index and .Seek methods at all, so I am guessing a bit
here. The method .NoMatch is normally used with .FindFirst etc. Should you
not be testing for .EOF with a failed .Seek?

HTH


Tim F
 

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