Connect, SourceTableName Properties Example (MDB)

The following example creates a TableDef object in the specified database. The procedure then sets its Connect and SourceTableName properties and appends the object to the TableDefs collection.

Sub ConnectSource()
    Dim dbs As Database, tdf As TableDef

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Create new TableDef object.
    Set tdf = dbs.CreateTableDef("PDXAuthor")
    ' Attach Paradox table Author in database C:\PDX\Publish.
    tdf.Connect = "Paradox 4.X;Database=C:\PDX\Publish"
    tdf.SourceTableName = "Author"
    dbs.TableDefs.Append tdf
    Set dbs = Nothing
End Sub