Option Compare Database
Public Sub Reconnect_Database_Table_Links()
Dim db As DAO.Database
Dim tbd As DAO.TableDef
Dim PathIs As String
'Detect path
PathIs = Application.CurrentProject.Path
Set db = CurrentDb
'FTT_BUDGETED
Set tbd = db.CreateTableDef(Name:="FTT_BUDGETED")
tbd.SourceTableName = "FTT_BUDGETED"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Budget.mdb"
db.TableDefs.Append tbd
'FTT_ACTUALS
Set tbd = db.CreateTableDef(Name:="FTT_ACTUALS")
tbd.SourceTableName = "FTT_ACTUALS"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_FTT_Actuals.mdb"
db.TableDefs.Append tbd
'LOCATIONS
Set tbd = db.CreateTableDef(Name:="LOCATIONS")
tbd.SourceTableName = "LOCATIONS"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Manager.mdb"
db.TableDefs.Append tbd
'TRANSPORT_MODES
Set tbd = db.CreateTableDef(Name:="TRANSPORT_MODES")
tbd.SourceTableName = "TRANSPORT_MODES"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Manager.mdb"
db.TableDefs.Append tbd
'LANES
Set tbd = db.CreateTableDef(Name:="LANES")
tbd.SourceTableName = "LANES"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_FTT_Actuals.mdb"
db.TableDefs.Append tbd
'LANE_TRANSPORT_MODES
Set tbd = db.CreateTableDef(Name:="LANE_TRANSPORT_MODES")
tbd.SourceTableName = "LANE_TRANSPORT_MODES"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_FTT_Actuals.mdb"
db.TableDefs.Append tbd
'USERS
Set tbd = db.CreateTableDef(Name:="USERS")
tbd.SourceTableName = "USERS"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Manager.mdb"
db.TableDefs.Append tbd
'CAL_YEAR
Set tbd = db.CreateTableDef(Name:="CAL_YEAR")
tbd.SourceTableName = "CAL_YEAR"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Manager.mdb"
db.TableDefs.Append tbd
'CAL_MONTH
Set tbd = db.CreateTableDef(Name:="CAL_MONTH")
tbd.SourceTableName = "CAL_MONTH"
tbd.Connect = ";DATABASE=" & PathIs & "\SMC_Logistics_Manager.mdb"
db.TableDefs.Append tbd
End Sub
|