Display the path of a linked table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I display the path of a linked tabled through VB. I am using Access 97.
 
I entered the command in a Msgbox and it returned a long string. However, I
cannot view the string while I type it in a table field because I must first
close the message box. Can I view the path of a linked table in a report or
query that I can copy-n-paste from?
 
Yes, you can, but it takes a little workaround. First, create a Public
Function to return the name of the linked table:


Public Function LinkedTableSource(strTableName As String) As String
On Error Resume Next
LinkedTableSource = CurrentDb.TableDefs(strTableName).Connect
End Function

Now, you can use that function in the SQL of a query:


SELECT MSYSOBJECTS.Name, LinkedTableSource([name]) AS ConnectInfo
FROM MSYSOBJECTS
WHERE MSYSOBJECTS.Type=6


Note: Type = 6 is the criteria for only selecting linked tables in
Access.

You can also use this function in a report, form, etc. I didn't
include any handling of errors, you might want to in your application.


Chris Nebinger
 

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


Back
Top