Creating links to external tables

  • Thread starter Thread starter Paul Burdett
  • Start date Start date
P

Paul Burdett

Hi All

My front end database needs to link to a set of tables in a remote Access
database.

I am using:

Public Function CreateLinks(strFileName)
'Create links to an external database

Dim FrontDB As DAO.Database
Dim BackDB As DAO.Database
Dim Tbl As DAO.TableDef
Dim Lnk As DAO.TableDef

Set FrontDB = CurrentDb
Set BackDB = OpenDatabase(strFileName)

For Each Tbl In BackDB.TableDefs
If Tbl.Attributes = 0 Then
Set Lnk = FrontDB.CreateTableDef(Name:=Tbl.Name)
Lnk.SourceTableName = Tbl.Name
Lnk.Connect = ";DATABASE =" & BackDB.Name
FrontDB.TableDefs.Append Lnk
End If
Next

Everything seems to work until I get to the Append Lnk and it stops,
complaining 'invalid argument'. I cannot see what I am doing wrong. I am
using Access 2000.

Any help gratefully received.

Paul
 
Hi Joe

Thansk for the quick response. The code you pointed to is for relinking
tables. However I am trying to create a link from new ie no pre-existing
link.

Kind Regards

Paul
 
Back
Top