Linking tables to databases in code

I have a database designed in Access 2003 for which I used the 'get external data' option to link (not import) data files. However, I would like to save the database 'unlinked' and have the code link the tables when it's run. This is so that when I run it on another machine, I can specify a path for where to find the tables with the database in runtime mode.

Can you help

Ollie VB




Answer this question

Linking tables to databases in code

  • bkitduy

    Ok this isn't a complete solution but I'll give you enough information for you to work out how to do it. I've done this once, a while ago, and I have no idea where the source code is, all I can remember is the main class I used.

    Do a search for the TableDef object. This is an object that lets you define new tables including linked tables. Look at the Connect property and SourceTableName property, also there is a RefreshLink method to. I'm looking at the help for these right now and there are some examples in there that you can maybe adapt. All the best.



  • Linking tables to databases in code