How do I open a linked table?

kwokv616

Registered User.
Local time
Today, 03:04
Joined
Nov 10, 2008
Messages
46
If a table is imported into the database, we write:
Dim rst_p, rst_r As DAO.Recordset
Set db = CurrentDb
Set rst_p = db.OpenRecordset("Pol", dbOpenTable)
Set rst_r = db.OpenRecordset("Rid", dbOpenTable)
But if the tables are linked instead, what code should i write to open it?

Thank you very much!
 
Dim rst_p, rst_r As DAO.Recordset

should actually be:
Dim rst_p as DAO.Recordset, rst_r As DAO.Recordset
Very important!
 
Hi, Thank you.
But what do u mean by change the file name?
my files to be opened are "Rid" and "Pol"

The problem i have is it says "Invalid operation" when i run the code, and it highlights the line Set rst_p = db.OpenRecordset("Pol", dbOpenTable).

i dont know what has gone wrong...=(
 
You cannot use dbOpenTable on a linked table...

remove that... you will be fine, except using "Seek" and indexes will cause problems.
 

Users who are viewing this thread

Back
Top Bottom