R
Rli
Hi all,
I have a front end (containing forms, reports and querys) and a back end
(containing tables only).
In a front end form i want to be able to change all table links to another
back end file (another .mdb with exactly the same table definitions). So i
tried:
Dim tbl As TableDef
Dim db As Database
Dim DatabaseName As String
Dim lnk As String
Set db = CurrentDb
lnk = "c:\newbackendname.mdb"
For I = 0 To db.TableDefs.Count - 1
Set tbl = db.TableDefs(I)
If Left(tbl.Connect, 9) = ";DATABASE" Then
tbl.Connect = ""
tbl.Connect = ";DATABASE=" & lnk
tbl.RefreshLink
End If
Next
DatabaseName =
Mid(DBEngine.Workspaces(0).[Databases](0).[TableDefs]("onetablename").[Connect], 11)
After this DatabaseName still contains the old . mdb file name...so
obviously i am missing something.
Can anyone help me how to do this correctly?
I have a front end (containing forms, reports and querys) and a back end
(containing tables only).
In a front end form i want to be able to change all table links to another
back end file (another .mdb with exactly the same table definitions). So i
tried:
Dim tbl As TableDef
Dim db As Database
Dim DatabaseName As String
Dim lnk As String
Set db = CurrentDb
lnk = "c:\newbackendname.mdb"
For I = 0 To db.TableDefs.Count - 1
Set tbl = db.TableDefs(I)
If Left(tbl.Connect, 9) = ";DATABASE" Then
tbl.Connect = ""
tbl.Connect = ";DATABASE=" & lnk
tbl.RefreshLink
End If
Next
DatabaseName =
Mid(DBEngine.Workspaces(0).[Databases](0).[TableDefs]("onetablename").[Connect], 11)
After this DatabaseName still contains the old . mdb file name...so
obviously i am missing something.
Can anyone help me how to do this correctly?