Applecore Pages on Microsoft Access

Removing Linked Tables from a Database

If you want to remove linked tables from a database, then you can just delete the table from the existing database, which will just delete the link. Here is some code to remove all linked tables from a database:

Sub sRemoveLinks()
    Dim db As Database
    Dim tdf As TableDef
    Dim intCount As Integer, intPos As Integer
    Set db=DBEngine(0)(0)
    intCount=db.TableDefs.Count-1
    For intPos=intCount to 0 Step -1
        Set tdf=db.TableDefs(intPos)
        If Len(tdf.Connect)>0 Then
            DoCmd.DeleteObject acTable, tdf.Name
        End If
    Next intPos
End Sub

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 15:00:29