How to remove the table link?

itlearner

Registered User.
Local time
Today, 09:44
Joined
Jun 13, 2006
Messages
20
anyone know how to remove the table link (not delete linked table) at run time?
 
itlearner said:
anyone know how to remove the table link (not delete linked table) at run time?

I don't know why you want to remove the link but the following code can remove the link for you.

Code:
Function ListReferenceFilePath()
    Dim TablesInDB As TableDefs
    Dim TablesConnectedTo As Variant

Set TablesInDB = CurrentDb.TableDefs
    For Each TablesConnectedTo In TablesInDB
        If TablesConnectedTo.Connect <> "" Then
            Debug.Print TablesConnectedTo.Connect
' Following code changes the path to the connected DB
            TablesConnectedTo.Connect = ";DATABASE=" & NewFilePathAndNname
            TablesConnectedTo.RefreshLink
        End If
    Next
End Function
 

Users who are viewing this thread

Back
Top Bottom