Macro to Link Tables

djl0525

Well-known Member
Joined
Dec 11, 2004
Messages
1,240
Still crashing...

Can I write a macro that will import linked tables for me? Where would I put the list of tables I want to import?

DJ
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I think this will point you in the right direction

Start with a Make Table Query using the linked table as your source.

Then construct a macro which starts with that query
Select Object (This will be the query you have just created)
Add a msgBox (to make sure you have correct source table)
Add some SendKeys (to automate the next few steps)
Add another MsgBox (to confirm everything is going to plan)
Run another macro (to name the table or manipulate the data as required).

HTH

Bernard
 
Upvote 0
This is the general syntax to link a table from another database:

DoCmd.TransferDatabase acLink, "Microsoft Access", "C:\MyDatabase.mdb", acTable, "MyTable", "MyLinkedTable", False
djl0525 said:
Where would I put the list of tables I want to import?
There are various places you could have the list:

  • a table
  • an array
  • a text file
 
Upvote 0
Thanks guys. I appreciate your input. While I waited to hear back from you I tried using Excel. I am currently using Microsoft Query to import the data from the Oracle database into an Excel worksheet. Excel has not lost the connection once. Everything is going according to plan. The new plan, that is.

DJ
 
Upvote 0

Forum statistics

Threads
1,221,842
Messages
6,162,333
Members
451,760
Latest member
samue Thon Ajaladin

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