Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    how to refresh a link (Access 2000)

    How can i refresh a link with the back end of a database? The link that i have is the following:

    DoCmd.TransferDatabase acLink, "Microsoft Access", GPath, acTable, "products", "products"

    How can i refresh it?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: how to refresh a link (Access 2000)

    Interactively, you can use the Linked Table Manager (Tools/Add-ins).

    In code, you can use DAO. The following function takes the full path and file name of the backend database as argument and returns True if all links have been successfully refreshed. It assumes you have links to just one other database. The function was modified from the Developer Solutions database that is included with Access 97.

    Function RefreshLinks(strFileName As String) As Boolean
    Dim tdf As DAO.TableDef
    On Error Resume Next
    ' Loop through all tables in database.
    For Each tdf In CurrentDb.TableDefs
    ' If the Connect property is non-empty, the table is linked
    If Len(tdf.Connect) > 0 Then
    tdf.Connect = ";DATABASE=" & strFileName
    tdf.RefreshLink ' Re-link the table.
    If Err Then
    RefreshLinks = False
    Exit Function
    End If
    End If
    Next tdf
    Set tdf = Nothing
    RefreshLinks = True ' All links have been refreshed.
    End Function

    Example usage:

    If RefreshLinks("D:AccessBackend.mdb") = False Then
    ' Something went wrong
    MsgBox "Couldn't refresh all links"
    End If

Posting Permissions

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