You need a reference to DAO to use this code. If you don't want to set that, then use Dim tdf As Object instead.
Dim tdf As TableDef 'the name of the table in the source database Dim strSourceName As String 'the local name; often the same but can be different Dim strLocalName As String 'the full path to the MDB file, like "G:\Data\Source.mdb" Dim strSourceDatabase As String 'assign the appropriate values to the string variables here, 'or make them parameters to a function containing this code. With CurrentDb Set tdf = .CreateTableDef(strLocalName) tdf.SourceTableName = strSourceName tdf.Connect = ";DATABASE=" & strSourceDatabase .TableDefs.Append tdf .Close End With Good luck, Peter Hoogenboom --- In [email protected], oc_for_me <[EMAIL PROTECTED]> wrote: > > Given the pathname, MDB filename , and table name , how would I > programmically (using VBA) link the above table from within Access > application. > > I have an MS-Access application (MASTER.MDB) which creates a NEW mdb > file & table say (C:\TEST\DATA-2007.MDB, tablename: DATA-2007). From > within MASTER.MDB, how would I link the new table to MASTER.MDB? > > Thank you! > > Dennick >
