.NoMatch Compile Error

  • Thread starter Thread starter Helen
  • Start date Start date
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,
 
In your References, are you specifying ActiveX Data
Objects Libraries? If you are then de-select these
libraries then try again.

Tony C
 
.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
 
Back
Top