FindFirst work only with linked tables

G

giovanni tirelli

With this code
Dim dbs As Database
Dim rs As Recordset
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("MyTable")
rs.FindFirst "ID = 'MyValue'"
If MyTable is NOT a linked table in the last row I receive the Error 3251
that mens about (I translate from Italian) The operation do not support
this kind of object.
Do you know why?
 
B

Brian

giovanni tirelli said:
With this code
Dim dbs As Database
Dim rs As Recordset
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("MyTable")
rs.FindFirst "ID = 'MyValue'"
If MyTable is NOT a linked table in the last row I receive the Error 3251
that mens about (I translate from Italian) The operation do not support
this kind of object.
Do you know why?

Yes. If you open a recordset on a local table without specifying the
recordset type, you will get a table-type recordset. You cannot use the
FindFirst method on a table-type recordset, you must use the Seek method.
If you want to use the FindFirst method (advisable, if you might split the
database in future), then you must open the recordset as a dynaset or
snapshot.
 

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

Similar Threads


Top