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

    Delete tables (Access 2000)

    Is there any function to delete only the linked tables and leave undeleted the unlinked ones ?

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

    Re: Delete tables (Access 2000)

    Try this - I have added comments in the code.
    <code>
    Sub DeleteLinkedTables()
    Dim dbs As DAO.Database
    Dim i As Integer

    ' Reference to database
    Set dbs = CurrentDb

    ' Loop backwards through the tables
    For i = dbs.TableDefs.Count - 1 To 0 Step -1
    ' Check whether the Connect property is not blank
    If Not dbs.TableDefs(i).Connect = "" Then
    ' If yes, it is a linked table, so delete it
    dbs.TableDefs.Delete dbs.TableDefs(i).Name
    End If
    Next i

    Set dbs = Nothing
    End Sub
    </code>
    You need a reference to the Microsoft DAO 3.6 Object Library in Tools | References.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete tables (Access 2000)

    Works like a fury ! Deletes all the linked tables! Thank you !

Posting Permissions

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