>I'm looking for a way to relink an access table using vb. I have it working in Access using the DoCmd.TransferDatabase. Does anyone have a way to do this?
>
>The reason I need to be able to do this is that I make modifications in an mdb that links to tables in either a Test database or the live database. I need a way to switch between them through VB code so that when a user logs on based on a registry entry it will relink to either the live data or production.
>
>Any help would be greatly appreciated.
>
>Nichole Brelje
If the links exist already, you can change table links by using the tabledefs collection:
thisdb.TableDefs(0).Connect = "FoxPro 2.6;DATABASE=" & strNewConn
thisdb.TableDefs(0).RefreshLink
thisdb.TableDefs.Refresh
Where thisdb refers to the opened MDB database and strNewConn has the path to the new source.