Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error setting a recordset in a linked table using DAO

Status
Not open for further replies.

N2Life

Programmer
Dec 21, 2002
90
0
0
US
I have an Access 2003 database. Behind one form I have this code

Dim D As Database
Dim t As Recordset
.
.
Set D = CurrentDb
Set t = D.OpenRecordset("tblInv", dbOpenTable)

Reference is: Microsoft DAO 3.6 Object Library

This works fine when tblInv is actually part of the database.

But when I put tblInv in a separate database and linked to it, I got an error when the code reached the Set t = line:

Run-time error '3219': Invalid operation.

To get around this in a pinch, I switched over to ADO processing and the program now works again. But I don't understand why the error with the DAO approach. Has anybody else run into this?
 
Don't specify option, or specify dbOpenDynaset. dbOpenTable, as far as I know, will only work on native tables.

Roy-Vidar
 
Thank you RoyVidar. I had just this moment switched to dbOpenDynaset with good success. Problem solved!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top