Linked Table Attributes (Extra help needed)

  • Thread starter Thread starter Brad
  • Start date Start date
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
 
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
 
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
 
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)


.
 
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
 
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
 
Back
Top