Solved

MS Access acLink automation

Posted on 2009-04-08
7
439 Views
Last Modified: 2013-11-27
I have a database where i need to link ALL tables from two other databases.
what I want to do is provide the user with open file dialog, have them select the mdb then link all tables.

Where I have a question is how can I get a list of all the tables in the mdb selected so I can loop through them with TransferDatabase acLink?

0
Comment
Question by:keschuster
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 8

Expert Comment

by:masterjojobinks
ID: 24099247
use the TableDefs collection

For a = 1 To CurrentDb.TableDefs.Count
    CurrentDb.TableDefs(a).Name
Next a
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 100 total points
ID: 24099269
Conceptually, you will need to open the external database, then loop through the TableDefs collection to get the list of tables.

mx
0
 

Author Comment

by:keschuster
ID: 24099279
Isn't this for the table I'm linking FROM

I need to get the tables from what I'm linking TO.  So basically I asked the user to give me the name of the table.  Now that I know the name of the mdb - what are the tables in it
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:keschuster
ID: 24099284
DatabaseMX - how would I do that with VBA?
0
 
LVL 8

Assisted Solution

by:masterjojobinks
masterjojobinks earned 100 total points
ID: 24099319
MX is right,
You will have to open the database you are trying to link to and loop through its TableDefs collection using code.  As you loop through you can link the tables.
0
 
LVL 3

Accepted Solution

by:
Dirk Eberhardt earned 300 total points
ID: 24099350
You can use

    Dim dbBackend As Database
    Set dbBackend = DBEngine(0).OpenDatabase("YourPath")

an then

    For i = 0 To dbBackend.TableDefs.Count - 1
        Debug.Print dbBackend.TableDefs(i).Name
    Next
0
 
LVL 75
ID: 24099378
There you go ...

mx
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now