Changing Linked Table link? 
Author Message
 Changing Linked Table link?

Is there a way to programmatically change the destination of a linked table?
I have an MDB that is just an interface with some value add to another MDB.
All of it's tables are linked to the other MDB. The other MDB is installed
on various systems in different places. So, I'd like the interface .MDB to
change it's own links based on, say, the COMPUTERNAME environment variable.

--
{*filter*} Watson



Tue, 26 Sep 2000 03:00:00 GMT  
 Changing Linked Table link?

You can change the Connect property of the tabledefs to include the
new path and then use the RefreshLink method to update the link. Here
is some sample code that also puts up a progress meter in the status
bar.
        Dim db as Database
        Dim tdf as TableDef
        Dim strNewDB as String
        Dim intTableDefCount as Integer

       'You may want to pass strNewDB to the proc
       '   as a parameter, instead.
        strNewDB = "New path\file"
        Set db = CurrentDb
        Call SysCmd(acSysCmdInitMeter, _
         " Updating the links to the data file . . .", _
         db.TableDefs.Count)
        For Each tdf In db.TableDefs
            If (tdf.Attributes And dbAttachedTable) = _
             dbAttachedTable Then
                    tdf.Connect = ";DATABASE=" & strNewDB
                    tdf.RefreshLink
            End If
            intTableDefCount = intTableDefCount + 1
            Call SysCmd(acSysCmdUpdateMeter, intTableDefCount)
        Next
        Call SysCmd(acSysCmdRemoveMeter)

 -- Andy


Quote:
>Is there a way to programmatically change the destination of a linked table?
>I have an MDB that is just an interface with some value add to another MDB.
>All of it's tables are linked to the other MDB. The other MDB is installed
>on various systems in different places. So, I'd like the interface .MDB to
>change it's own links based on, say, the COMPUTERNAME environment variable.

>--
>Dick Watson




Tue, 26 Sep 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Changing the linked table path without the linked table manager

2. Linked tables - changing the link

3. linking all fields in linked table?

4. To link procedure and table in visual linking...

5. Change Table Link programatically

6. With Code - CHANGE linked tables?? Sample

7. Changing linked table source by VBA

8. Changing Table Link Information

9. Linked table manager to be changed from (X:\) a server drive to (C:\) a local machine

10. Referential Integrity - changing in linked tables

11. Can I change the field size of a linked table

12. Changing Data Type while linking table to a CSV

 

 
Powered by phpBB® Forum Software