[AccessD] Fast back-end relinking?

Christopher Hawkins clh at christopherhawkins.com
Thu Jun 5 14:06:58 CDT 2003


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-



More information about the AccessD mailing list