Object to retrieve path name of table

G

Guest

I am looking for a VB command to return the pathname of
one of an attached table. I have an application that uses
a common front end but 3 different back ends. I would
like to be able to return the path of the back ends and
then make it so i can save files in these specific
locations. Any help would be appreciated.. THANKS
 
W

Wayne Morgan

The path is in the .Connect property of the TableDef object. You may also
want to use the following attibutes to see if the table is a linked table.
If it isn't then the .Connect property should be "". Here is part of an
example that refreshes links.

Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
With tdf
If .Attributes = dbAttachedTable Then
strConnectPath = Dir("\\Server\Database\Sobc_be.mdb")
If UCase(strConnectPath) = "SOBC_BE.MDB" Then
If Not InStr(.Connect, "\\Server\Database\sobc_be.mdb")
.Connect = ";DATABASE=\\Server\Database\Sobc_be.mdb"
.RefreshLink
Else
'If the table is already linked to the server
'then we should be done.
Exit For
End If
End If
End If
End If
End With
Next
 
G

Guest

Thank you very much, I did get this to work and it did do
what i needed. Thanks for the help.
-----Original Message-----
The path is in the .Connect property of the TableDef object. You may also
want to use the following attibutes to see if the table is a linked table.
If it isn't then the .Connect property should be "". Here is part of an
example that refreshes links.

Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
With tdf
If .Attributes = dbAttachedTable Then
strConnectPath = Dir ("\\Server\Database\Sobc_be.mdb")
If UCase(strConnectPath) = "SOBC_BE.MDB" Then
If Not InStr
(.Connect, "\\Server\Database\sobc_be.mdb")
= ";DATABASE=\\Server\Database\Sobc_be.mdb"
 

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