How to retrieve info about a linked table?
How to retrieve info about a linked table?
am 04.04.2008 12:40:36 von Mido Moonlite
Hi, i've created a linked table in my access database (with
DoCmd.TransferDatabase). But how can i retrieve the info about that
table? i'd like to know where the path of the original database source
is.
Thanks in advance. Regard.
*** Sent via Developersdex http://www.developersdex.com ***
Re: How to retrieve info about a linked table?
am 04.04.2008 13:14:57 von Peter James
"Mido Moonlite" wrote in message
news:1207305071_1550@news.newsfeeds.com...
> Hi, i've created a linked table in my access database (with
> DoCmd.TransferDatabase). But how can i retrieve the info about that
> table? i'd like to know where the path of the original database source
> is.
> Thanks in advance. Regard.
>
> *** Sent via Developersdex http://www.developersdex.com ***
In your front end database create a form with a Label on it.
Put the following code in one the Form events (I use Form Current())
********************
Dim dbs As Database
Dim tdf As TableDef
Dim strConnString As String
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If Len(tdf.Connect) <> 0 Then
strConnString = tdf.Connect
Else
strConnString = "There is no Connection String"
End If
Next
Me.lblConnStr.Caption = strConnString
Set tdf = Nothing
Set dbs = Nothing
*******************************
When you open the form, the label caption will be the connect string showing
the path to the database where your linked tables are. If you have password
protected your back end database, then the connect string will also include
the password.
You should be able to find this on one of the MVP websites.
HTH
Re: How to retrieve info about a linked table?
am 04.04.2008 14:21:27 von Allen Browne
Open the linked table in design view.
Open the Properties box, and look in the Description property.
If you want to get it programmatically, open the Immediate Window (Ctrl+G),
and enter:
? CurrentDb.TableDefs("MyTable1").Connect
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mido Moonlite" wrote in message
news:1207305071_1550@news.newsfeeds.com...
> Hi, i've created a linked table in my access database (with
> DoCmd.TransferDatabase). But how can i retrieve the info about
> that table? i'd like to know where the path of the original database
> source is.
Re: How to retrieve info about a linked table?
am 05.04.2008 04:01:20 von Chuck Grimsby
On Fri, 4 Apr 2008 20:21:27 +0800, "Allen Browne"
wrote:
>Open the linked table in design view.
>Open the Properties box, and look in the Description property.
>
>If you want to get it programmatically, open the Immediate Window (Ctrl+G),
>and enter:
> ? CurrentDb.TableDefs("MyTable1").Connect
or in a query:
SELECT Database, [Name], ForeignName
FROM MSysObjects
WHERE Database Is Not Null
AND [Name] Not Like 'MSys*'
AND [Type] In (1,4,5,6) AND Left$([Name],1)<>'~'
ORDER BY Database, [Name];
To include ODBC databases, change the WHERE clause to:
WHERE (Database Is Not Null
AND [Name] Not Like 'MSys*'
AND [Type] In (1,4,5,6) AND Left$([Name],1)<>'~')
OR (ForeignName Is Not Null AND [Type]=4)
--
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
Re: How to retrieve info about a linked table?
am 06.04.2008 00:59:05 von PW
On Fri, 04 Apr 2008 05:40:36 -0500, Mido Moonlite
wrote:
>Hi, i've created a linked table in my access database (with
>DoCmd.TransferDatabase). But how can i retrieve the info about that
>table? i'd like to know where the path of the original database source
>is.
>Thanks in advance. Regard.
>
>*** Sent via Developersdex http://www.developersdex.com ***
Good post! You read my mind! How did you know I was trying to figure
that out? :-)
Good answers too.
Thanks,
-pw