Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2002
    Posts
    168

    Unanswered: Database DIrectory

    I have a linked database that link to a master database. The problem I have is if I move the master database to another directory, the linked database cannot find where the master database now is. In that case, what should I do to link them again should the master database is moved to different directory ?

  2. #2
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Milan,

    Just go to the linked tables manger, and set the new location.

  3. #3
    Join Date
    Apr 2002
    Posts
    168
    Miguel,

    Thanks. I have a situation like this :

    I wanna send to my friend these 2 files (linked DB and original DB). So when he saves it to his hard drive, will it still be linked, because the directory is already changed ? If not linked, let's say he moves the original DB to a different directory, can he link the linked DB to original DB without using Linked Table Manager, i.e. automatically done ?

    I already tried the linked DB u told me earlier, it works fine.

  4. #4
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Milan,

    Once a database is linked, stills linked, even if you delete the original one, and make a new one with the same tables and fields, the link still work.

    To set up the new location there's three ways, using the linked tables manager, or directly by code, which goes the same, or deleting the linked tables, and link a new ones.

  5. #5
    Join Date
    Apr 2002
    Posts
    168
    Miguel,

    Let's say I have my original and linked database in this directory:

    C:LinkedDB.mdb
    F:OriginalDB.mdb ---> Network


    Then my friend moves it to his drive:

    D:LinkedDB.mdb
    G:OriginalDB.mdb ----> Network


    I tried move the originalDB to D drive, then the linkedDB cannot find it, so I have to use Linked Table Manager to re-link it.

    One thing for sure, my friend does not want use Linked Table Manager or re-link it manually, so the only way to detect a new directory automatically is by using VBA code ? My aim is I just send the files to him, and he can move the files (at least the originalDB) anywhere in his drive without worrying about re-link etc.

    Thanks.

  6. #6
    Join Date
    Apr 2002
    Posts
    168
    Miguel, here is my code.

    Dim cat As ADOX.Catalog
    Dim tbl As ADOX.Table

    Set cat = New ADOX.Catalog
    cat.ActiveConnection = CurrentProject.Connection

    Set tbl = New ADOX.Table
    tbl.Name = "test"
    Set tbl.ParentCatalog = cat

    tbl.Properties("Jet OLEDB:Create Link") = True
    tbl.Properties("Jet OLEDB:Link Datasource") = "F:\Folder\MyDB.mdb"
    tbl.Properties("Jet OLEDB:Link Provider String") = ";pwd=password"
    tbl.Properties("Jet OLEDB:Remote Table Name") = "MyTable"

    But, this one only works when the table 'test' does not exist. What if I just wanna relink table 'test' to a different directory/DB ? Thanks.

  7. #7
    Join Date
    Apr 2002
    Location
    Portugal
    Posts
    146
    Milan,

    Here is the sample, it's in a zip file.

    You may enconter some errors, due to diferent versions of access. But the main issue, the related tables, i think it is well examplified, see how it works, modify if you won't, say something if you don't understand.

    Concerning to the code you post in last reply, i must say that i'm not very well familiard with that issue, that is some parts of the VB language that i never take a look, i'm sorry, but in that i can't help you.
    Attached Files Attached Files

  8. #8
    Join Date
    Apr 2002
    Posts
    168
    Miguel,

    Thanks for the file. I already solved the linked table I asked you in the previous question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •