We help IT Professionals succeed at work.

Microsoft Access 2010 - Link ODBC tables programmaticaly

rdbrunet
rdbrunet asked
on
I have a number of databases that link to ODBC connected SQL Server tables.  Some of them have dozens of links that have to be maintained individually.  Is there a simple programmatic way to have Microsoft Access 2010 create those links when the application starts and release them when its finished?
Comment
Watch Question

President / Owner
GOLD EXPERT
Fellow
Most Valuable Expert 2017
Commented:

 Certainly.   Linked tables are tabledef objects with their .Connect property set in a certain way.   ODBC linked tables all start off with "ODBC;" for example.

 Take a look at the attached example, which has some code that shows re-creating attached table links based on a table.

  As for removing, all you would need to do is delete the Tabledef objects at close.

Jim.
Relink2.Zip

Explore More ContentExplore courses, solutions, and other research materials related to this topic.