By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,484 Members | 1,764 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,484 IT Pros & Developers. It's quick & easy.

Relinking Tables - Access 2003

P: n/a
I was uaing some code derived from the Northwind database to relimk tables at
startup.

The code works well in accerss 97/2000, but does not in 2003

Does anyone have any references to a Relinker in Access 2003?

Thanks - AB
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"ABinBoston" <ab********@aol.com> wrote in message
news:20***************************@mb-m01.aol.com...
I was uaing some code derived from the Northwind database to relimk tables
at
startup.

The code works well in accerss 97/2000, but does not in 2003

Does anyone have any references to a Relinker in Access 2003?


Try this:
--------------------------------------------------
Private Sub Command0_Click()
Dim db As Database, n As Integer, i As Integer
Dim TFileName As String, LinkedTable As TableDef
Dim LocalTableName() As String, TableArray() As String
Set db = CurrentDb

' External database
TFileName = "C:\JollyService_2004\JollyService_T.mdb"
DoCmd.Hourglass True
n = 4
ReDim TableArray(1 To n)

' Tables existing on external database
TableArray(1) = "t_UM"
TableArray(2) = "t_IVA_Aliq"
TableArray(3) = "t_Trasporti"
TableArray(4) = "t_CT"
ReDim LocalTableName(1 To n)

' Names you want to assign to linked tables
LocalTableName(1) = "T1"
LocalTableName(2) = "T2"
LocalTableName(3) = "T3"
LocalTableName(4) = "T4"

' If you want to link external tables with their
' external names use the REMed Set LinkedTable
' instead of the other one.
For i = 1 To n
Set LinkedTable = db.CreateTableDef(LocalTableName(i))
'Set LinkedTable = db.CreateTableDef(TableArray(i))
LinkedTable.Connect = ";DATABASE=" & TFileName
LinkedTable.SourceTableName = TableArray(i)
db.TableDefs.Append LinkedTable
Next i
db.TableDefs.Refresh
DoCmd.Hourglass False
End Sub
---------------------------------------------------------------
Bruno
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.