How to Programmatically Delete Linked Tables from Backend Only

AlexB123

Board Regular
Joined
Dec 19, 2014
Messages
207
Happy Friday, everyone!

I am working on code that will help me set up different Front Ends to different Back End tables without manually importing tables or using the Linked Table Manager. I have already figured out how to automate the import and relinking functionality, but now I want to add a functionality to delete the links already in the database. However, I DO NOT want to delete the Linked Excel Sheets.

Is there a way to exclude linked Excel tables from the rest of the linked tables to be deleted?

Here is the link where I got the code to delete the tables:

https://www.devhut.net/2011/06/10/ms-access-vba-delete-all-linked-tables/
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You should have tableDef properties to look at that tell you what kind of table/linked table you are dealing with. Probably the Connect property. I'd loop the tables in the DB (tabledefs collection) and check it out.
 
Upvote 0
You should have tableDef properties to look at that tell you what kind of table/linked table you are dealing with. Probably the Connect property. I'd loop the tables in the DB (tabledefs collection) and check it out.

How would you do that? Just send it to the immediate window, or to a file? Is there a way to check that info in the GUI?
 
Upvote 0
Using the immediate window is a good way to go. You can also print to the immediate window. Or to a message box.
For debugging in general in VBA see here:
http://krgreenlee.blogspot.com/2006/04/programming-excel-vba-debugging-for.html

For instance, you could create a small code snippet:

PSEUDOCODE
Code:
for each td in currentDatabase.TableDefs
    debug.print td.Connect

Then you can see what kind of values are in that property (as well as paying particular attention to the difference between the linked tables you are interested in, and the rest.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top