Results 1 to 2 of 2
2002-06-28, 07:03 #1
- 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?
2002-06-28, 09:13 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 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
Set tdf = Nothing
RefreshLinks = True ' All links have been refreshed.
If RefreshLinks("D:AccessBackend.mdb") = False Then
' Something went wrong
MsgBox "Couldn't refresh all links"