Using VBA code to make links to external data from MS Access mdb tables

  • Thread starter Pete Straman Straman via AccessMonster.com
  • Start date
P

Pete Straman Straman via AccessMonster.com

I want to incorporate code to accomplish this rather than using File\Get
External Data\Link Tables in MS Access. Can this be coded with VBA? If so,
please submit an example.

Thanks,

Pete S.
 
J

John Nurick

Hi Pete,

Either use
DoCmd.TransferDatabase acLink...
or write VBA to create and execute SQL statements using the IN clause,
e.g.
Dim strSQL As String
Dim rstR As DAO.Recordset
strSQL = "SELECT * FROM MyTable IN 'C:\Folder\My Database.mdb';"
Set rstR = DBEngine(0).(0).OpenRecordset(strSQL)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top