• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

How to Delete all Linked Tables in code?

I need some robust code to enable me to delete all linked tables in my MDB, but leave all the non-linked tables as they are.
This should be easy...High points for a fast answer!
0
SOTA
Asked:
SOTA
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:

Sub dropLinkedTables()
Dim db As DAO.Database, x As Variant
    Set db = CurrentDb
    For Each x In db.TableDefs
        If Len(x.Connect) > 0 Then
            db.Execute "drop table [" & x.Name & "]"
        End If
    Next
End Sub
0
 
SOTAAuthor Commented:
Perfect!! Thanks capricorn1
0
 
SOTAAuthor Commented:
Awesome as usual!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now