How do I link tables using only VBA code...

hollifd

Board Regular
Joined
Apr 3, 2002
Messages
248
Hello,

When a user clicks a button in my Access database, I want to use VBA code to link to tables in another Access database.

I am not in a hurry for the code because it is not something that is critical for me right now. I am only curious how it is done.

Does anyone have any code that they would share with me to do that or know where I can go to find the code?

Thanks for any help,

David
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
That link may help, however, more generally - what is it exactly you are trying to do and why?

This is the sample directly out of the built-in Access help showing the basic syntax.

Code:
DoCmd.TransferDatabase acLink, "ODBC Database", _
    "ODBC;DSN=DataSource1;UID=User2;PWD=www;LANGUAGE=us_english;" _
    & "DATABASE=pubs", acTable, "Authors", "dboAuthors"

Alternatives include raw SQL statements that build (make table queries) new tables based on the contents of external tables.
 
Upvote 0

Forum statistics

Threads
1,215,882
Messages
6,127,532
Members
449,385
Latest member
KMGLarson

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