[AccessD] Fast back-end relinking?

Christopher Hawkins clh at christopherhawkins.com
Thu Jun 5 14:37:26 CDT 2003


Gustav,

I can't use RefreshLink because the table links have been dropped
before the re-link is being made.  So, there are not tables to
refresh.

-C-

---- Original Message ----
From: gustav at cactus.dk
To: accessd at databaseadvisors.com, 
Subject: Re: [AccessD] Fast back-end relinking?
Date: Thu, 5 Jun 2003 21:24:26 +0200

>Hi Christopher
>
>Use RefreshLink:
>
>        Set tbl = db.TableDefs(rsData("TableName"))
>        tbl.Connect = ";DATABASE=" & rsData("Path")
>        tbl.RefreshLink
>        rsData.MoveNext
>
>Also, for increased speed, open the backend before the loop and close
>it when finished the loop.
>
>/gustav
>
>
>> First off:  I have seen (and used) Tribble's Back-End relinker
>> before.  That's not what I need in this case.
>
>> I have inherited an app with some back-end relinking code that is
>> very slow.  I've seen programmatic implementations of a table link
>> that linked up very quickly, as quickly as using File > Get 
>External
>> Data > Link Tables.  The one I'm dealing with takes many times as
>> long.
>
>> There is a table in my db called tblTable.  It contains the name 
>and
>> path of every table in the database.  The table is used in the
>> following code:
>
>> ***START***
>
>> Dim db As DAO.Database
>> Dim tbl As DAO.TableDef
>> Set db = CurrentDb
>> Dim rsData As DAO.Recordset
>
>
>>     Set rsData = db.OpenRecordset("SELECT * FROM tblTable")
>    
>>     rsData.MoveFirst
>    
>>     Do Until rsData.EOF = True
>>         Set tbl = db.CreateTableDef(rsData("TableName"))
>>         Debug.Print "Now attaching " & tbl.Name & "..."
>>         tbl.Connect = (";DATABASE=" & rsData("Path"))
>>         tbl.SourceTableName = rsData("TableName")
>>         db.TableDefs.Append tbl
>>         rsData.MoveNext
>>     Loop
>
>> db.Close
>
>> ***END***
>
>> All the lag takes place when running the 'db.TableDefs.append tbl'
>> line.
>
>> Is there any way to speed this process up?  I've seen it done more
>> quickly before, I just didn't get to see the actual code.  :(
>
>> -Christopher-
>
>> _______________________________________________
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list