Linked Table Attributes (Extra help needed)

B

Brad

Thanks for taking the time to read my question.

My original question was how to find out,
programmatically, the link info on a linked table (as
seen in linked table manager). In my case I have linked
to a text document, and I would like to know the file
path and the file name of the linked table.

I received some help from Allen Browne, Thanks Allen!!!!
(- Microsoft MVP. Perth, Western Australia.
)


Parse the file name and path from the Connect property of
the TableDef:
dbEngine(0)(0).TableDefs("MyTable").Connect

I tried this and got

Text;DSN=;FMT=Delimited;HDR=NO;IMEX=2;Database=C:\NewFolde
r

which is the file path to my database, not my text file.
It also doesn't include the file name. I think I can use
this in other places, but I still need a solution to my
problem.

Thanks again,

Brad
 
S

Steve

There is a hidden table called MSysObjects that contains information on all
the objects in the database; tables, queries, etc. This table holds the
connection string for linked objects and can be searched using a standard
SQL statement, eg 'SELECT * FROM MSysObjects' and getting the data back in a
recordset. To make the table visible goto to the menu item Tools/Options
and on the View tab make sure that Hidden Objects and System Objects are
ticked.

Hope this helps
 
D

Dirk Goldgar

Brad said:
Thanks for taking the time to read my question.

My original question was how to find out,
programmatically, the link info on a linked table (as
seen in linked table manager). In my case I have linked
to a text document, and I would like to know the file
path and the file name of the linked table.

I received some help from Allen Browne, Thanks Allen!!!!
(- Microsoft MVP. Perth, Western Australia.
)


Parse the file name and path from the Connect property of
the TableDef:
dbEngine(0)(0).TableDefs("MyTable").Connect

I tried this and got

Text;DSN=;FMT=Delimited;HDR=NO;IMEX=2;Database=C:\NewFolde
r

which is the file path to my database, not my text file.
It also doesn't include the file name. I think I can use
this in other places, but I still need a solution to my
problem.

Thanks again,

Brad

In the case of a linked text file, the TableDef object's SourceTableName
property holds the name of the file:

With DBEngine(0)(0).TableDefs("MyTable")
Debug.Print .Connect
Debug.Print .SourceTableName
End With
 
G

Guest

Thanks Dirk!!

Brad
-----Original Message-----


In the case of a linked text file, the TableDef object's SourceTableName
property holds the name of the file:

With DBEngine(0)(0).TableDefs("MyTable")
Debug.Print .Connect
Debug.Print .SourceTableName
End With

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
G

Guest

Thanks Steve.

I was not aware that table existed. In my case it didn't
hold the info I needed, but I am sure this knowledge will
come in very handy in the future.

Brad
 
T

Tim Ferguson

but I am sure this knowledge will
come in very handy in the future.

Don't bet on it. The structure and use of the system tables is not
documented and therefore not guaranteed to remain the same in other
versions of Access (quite likely but not certain).

B wishes


Tim F
 

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

Top