Linking with ADO

  • Thread starter Thread starter GPO
  • Start date Start date
G

GPO

Is it possible to create a linked table in Access 2000
using ADO? I'm not keen on using docmd.transferdatabase in
case I need to use the code in something other than Access.

FWIW The table being linked to is also an MS Access table.

Cheers

GPO
 
You can create links in VBA code using the following:

Sub ConnectOutput(dbLocal As Database, strTable As String, strConnect As
String, strSourceTable As String)

Dim tdf As TableDef

Set tdf = dbLocal.CreateTableDef(strTable)

tdf.Connect = strConnect
tdf.SourceTableName = strSourceTable
dbLocal.TableDefs.Append tdf

End Sub

Example call: ConnectOutput dbsTarget, "mytable", ";DATABASE=" & strDbPath,
"mylinkedtable"
 
Back
Top