Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Changing Backends (XP)

    I need a simple little procedure, that I can pass the full path to, that will update the table links to a
    eg RenewTableLinks("c:datanewbackend.mdb")

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Changing Backends (XP)

    Try this:
    <code>
    Sub RenewTableLinks(strBE As String)
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Set dbs = CurrentDb
    On Error GoTo ErrHandler
    For Each tdf In dbs.TableDefs
    If Not tdf.Connect = "" Then
    tdf.Connect = ";DATABASE=" & strBE
    tdf.RefreshLink
    End If
    Next tdf
    ExitHandler:
    Set tdf = Nothing
    Set dbs = Nothing
    Exit Sub
    ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub
    </code>
    Note: you must set a reference to the Microsoft DAO 3.6 Object Library in Tools | References...

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Backends (XP)

    I searched using google and found one that was quite good but it looked a bit old - (it looked at all objects not just tabledef) your's is much better. Very slick and efficient.

    I just modified it to be a function and return true if all went well.

    Your's still uses DAO specifically so it will work for my one client that is still using office 97.

    thank you

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Changing Backends (XP)

    > I just modified it to be a function

    LOL - I had a function lying around for this, but you asked for a procedure so I modified it to be a procedure <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Changing Backends (XP)

    I didn't know 'procedure' meant sub. but now I do. thanks again.

Posting Permissions

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