Link Table Mgr Update

D

DDBeards

I maintain two environments; one for development and one for production. Is
there a way to automatically update the Link Table? I have 20 tables linked
to 4 different mdf, during development I point to the development files and
then when I copy to production I must relink to production. I would like to
run a macro and do this automatically.

Thanks

Chris
 
P

Paolo

Hi DDBeards,
To relink your tables create a form with a text box named mypath and paste
the following code in the click event of a button so when you put a new path
in the text box (also the db name) and you click the button the table will be
relinked to this new path.

dim mytbdef As TableDef
dim tb_num As Integer

For tb_num = 0 To currentdb.TableDefs.Count - 1
Set mytbdef = currentdb.TableDefs(tb_num)
If (mytbdef.connect <> "") Then
If InStr(1, mytbdef.connect, mypath) > 0 Then Exit For
mytbdef.connect = ";DATABASE=" & mypath
mytbdef.RefreshLink
End If
Next tb_num

This is air code so you must test it

HTH Paolo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top