Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change table link path?

3 views
Skip to first unread message

LKG

unread,
May 16, 1999, 3:00:00 AM5/16/99
to
How can I change the link path between 2 db's to just
a directory (i.e., "\data"), rather than a complete
path? Now, when I take the db's home to work on,
I have to fudge a duplicate for the office's network
pathing. (Am I making any sense?)

:} l...@phantom.com

Michael Kaplan

unread,
May 16, 1999, 3:00:00 AM5/16/99
to
You can't.

You must use an absolute path. If you move the files you
need to add code to fix up the Connect property of the
TableDefs and then call the RefreshLink method.

--

Michael

-------------------------------
random junk of dubious value is at:
http://www.trigeminal.com

LKG <l...@phantom.com> wrote in message
news:373F2F5E...@phantom.com...

David Thomas

unread,
May 17, 1999, 3:00:00 AM5/17/99
to
LKG

Under NT anyways, the subst command is quite stable (I have heard bad
things about it in Win95). Using this command, I always do something
like

subst t: c:\users\me\database

That way when I switch computers, move users directory to new hard
drive, etc. I will be back up and running with my database, etc. on t:\
as soon as I can type the subst command (which are of course run by a
batch file at startup).

David

Matthew Nicoll

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to
On Sun, 16 May 1999 16:49:34 -0400, LKG <l...@phantom.com> wrote:

>How can I change the link path between 2 db's to just
>a directory (i.e., "\data"), rather than a complete
>path? Now, when I take the db's home to work on,
>I have to fudge a duplicate for the office's network
>pathing. (Am I making any sense?)

Frustrating isn't it!? Microsoft apps are keen on full file names,
non-portability etc.

I just wrote the following VB routine which checks the link path
of one linked table (in this case "AREA"), If it is not the same
as the path of the CurrentDB, I reset all the link paths. I call
this routine when the main database starts up.

Sub CheckLinks()
' Checks that the path on the Connect property of the Area table
is
' the same as the path of the current database. If it is not, it
assumed
' that the mdb (database) has been moved to a new directory, so
all
' connection paths are updated.
' (All this is because MS-Access insists on complete paths for
links.)

'----------------------------------------------------------------------------
Dim con As String
Dim path As String
Dim name As String
Dim fn As String ' full file name
Dim i As Integer
Dim t As TableDef
Dim lp As Integer ' Length of conPrefix
Const conPrefix = ";DATABASE="

lp = Len(conPrefix)

On Error GoTo NoArea
con = CurrentDb.TableDefs("Area").Connect
On Error GoTo 0

'--- connect property should be like:
";DATABASE=c:\pbs\hersam\HS_Lookup.mdb"

If Left(con, lp) <> conPrefix Then
MsgBox "Unexpected Connect property on Area table: " & nl2 & _
con & nl2
Exit Sub
End If

path = fn_Path(Mid(con, lp + 1))

If UCase(path) <> UCase(CurrentDBpath) Then

MsgBox "Setting the paths to linked tables to: " &
CurrentDBpath & _
nl2 & _
"(This is normal when HS_Entry2 is first started after
installation, " & _
nl & " or after moving to a new folder.)"

For Each t In CurrentDb.TableDefs
If t.Connect <> "" Then ' replace connection
path
fn = Mid(t.Connect, lp + 1)
name = fn_File(fn) ' just name and
extension, no path
t.Connect = conPrefix & CurrentDBpath & name
t.RefreshLink
End If
Next

End If
Exit Sub

NoArea:
MsgBox "No Area table found." & nl2 & _
"The Area table should be in the HS_Lookup database." & nl2
& _
"Files HS_Entry2.mdb, HS_Lookup.mdb, HS_TableDefs.mdb, and
any " & _
"yyyyFood.mdb and yyyy_Roe.mdb files must all be in the
same folder " & _
"before opening the HS_Entry2 database.", _
vbCritical
Exit Sub

End Sub


Lucas van Vloten

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to

I just happened to stumble upon the website of PDS Consulting, Inc. at
http://pdsconsulting.com . They have a download available called PDSRelink,
which contains really neat code solution that can help you relink your
tables. It's free(!), it's easy to implement and use and it's fully
configurable. They also have other great free utilities available for
download (such as a simple solution to implement a help system in your
project - very useful!)

Lucas van Vloten

Matthew Nicoll <meni...@mars.ark.com> schreef in berichtnieuws
37703e18...@news.ark.com...

Lucas van Vloten

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to

Lucas van Vloten

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to

Lucas van Vloten

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to

John Carter (jwccg)

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to
Matthew Nicoll wrote:
>
> On Sun, 16 May 1999 16:49:34 -0400, LKG <l...@phantom.com> wrote:
>
> >How can I change the link path between 2 db's to just
> >a directory (i.e., "\data"), rather than a complete

G'day.
I just use the old DOS subst command to map the required drive letter
to the parent of \data.
e.g. subst w: c:\DataBase
hth
--
John Carter j...@jwccg.com.au
John W Carter Computer Group Pty. Ltd. http://www.jwccg.com.au
2 Dougand Court, Dingley Village 3172. Melbourne Victoria Australia.

0 new messages