recordset index doesn't work with linked tables

  • Thread starter Thread starter Alan Bornat
  • Start date Start date
A

Alan Bornat

I am trying to split my database in front end and back end, with linked
tables, but my recordset.index property doesn't work any more nor does
..seek - am I doing something wrong?
 
Hi Alan,

That is correct - Index and Seek are only available with table-type
Recordset objects. There are two options - you can either open the backend
database directly, then open a table-type recordset and use the Index
property and seek method or open a recordset on the linked table and use one
of the Find methods (FindFirst, FindLast, FindNext, FindPrevious).

To open a tabletype recordset on the backend database use the Opendatabase
method to get a reference directly to the back end database (instead of
using currentdb()). Then open the recordset using the reference to the
backend database. Then, be sure to close the db - something you wouldn't
normally do with a db object that was created from currentdb().

Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = OpenDatabase("C:/mydata/mydb.mdb")
Set rst = db.OpenRecordset("tblMyTable", dbOpenTable)
With rst
' do what you need to do here
.Close
End With
db.Close
Set rst = Nothing
Set db = Nothing
 
Back
Top