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

  • Thread starter Thread starter Pete Straman Straman via AccessMonster.com
  • Start date 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.
 
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)
 
Back
Top