4

I want to move my Microsoft Access Database front end into source control for easy saving and deployment as well as have some control over changes. I am using code from this question to export queries, forms, macros, reports, however not tables.

There must be a way through vbscripts that I could export the link table build process as well as put it back in.

Does anybody know of anything that could easily let me export my linked tables.

(It would be easier for me to change my linked tables to link to a development server if I could build out the table linking to a text files and manipulate the connection strings from there.)

How do you use version control with Access development?

Or the question could also be, how do I painlessly change my link table connection source without messing with my computer's odbc dns connections?

Community
  • 1
  • 1
Mallow
  • 844
  • 1
  • 13
  • 37

1 Answers1

2

You didn't specify if you are using .mdb or .accdb files.
I never used .accdb, so I can only tell you about .mdb:

Every .mdb file has a hidden table named MSysObjects.
It contains all objects including forms and reports and stuff, but you can filter on the Type column to get only the tables:

  • Type = 1 --> local tables
  • Type = 4 --> ODBC linked tabled
  • Type = 6 --> linked tables from other Access databases

There are four columns in MSysObjects which contain everything you need:

  • Connect --> ODBC connection string (if connected via ODBC)
  • Database --> path to source Access database (if linked to another Access database)
    (you probably don't need this because you say you're using ODBC - I included it anyway for the sake of completeness)
  • Foreign name --> original name of the table in the source database
  • Name --> name of the linked table in this database

That's all the information you need to re-link the tables.
You don't need to mess around with the computer's ODBC DSNs for this...in fact, you don't need DSNs on the computer at all.

Here is a quick example how to do this:
VBA Code to Add Linked Table with Primary Key

Community
  • 1
  • 1
Christian Specht
  • 35,843
  • 15
  • 128
  • 182