Split Database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a procedure or a module that i can right that will automatically
update the linked tables if the directory or the place of the database change.

I have two databse one has all the tables and other has all the forms,
quries and reports. Now if I move the two databases to different computer I
have to re-map the path of the table databse to link to the other database.
But can I do something that no matter where I move this databse It will
automatically re-map the paths itself.
Note: I normally keep both of this database in one folder only.
If anybody has a suggestion Please let me know.
 
Try this.

Sub ReAttach()
Dim TD As TableDef
Dim BackEndPath As String
BackEndPath = Application.CurrentProject.Path & "\back.mdb"
For Each TD In CurrentDb.TableDefs
If TD.Connect > "" Then
TD.Properties("Connect") = ";DATABASE=" & BackEndPath
End If
Next
End Sub

This uses DAO so you'll need to add the reference.
 
Hi Tom
Wher should I triger this event at.
would this a written as module.
It looks like it should work form the code.
 
Sorry, didn't see your other question before.
Create a macro called Autoexec. In it create an action of RunCode and in the
properties window, put in the name of the below function, ReAttach ().
 

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

Back
Top