Solved

How to Delete all Linked Tables in code?

Posted on 2008-06-14
3
372 Views
Last Modified: 2010-04-21
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
Comment
Question by:SOTA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 21786439

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
 

Author Comment

by:SOTA
ID: 21786489
Perfect!! Thanks capricorn1
0
 

Author Closing Comment

by:SOTA
ID: 31467230
Awesome as usual!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question