Connect, SourceTableName Properties Example

This example attaches the table Orders.dbf (a dBASE IV table located in the C:\Program Files\Microsoft Office\Office folder) to the Nwindex.mdb database.

To create the Nwindex.mdb database, run the Microsoft Excel example for the CreateDatabase method.

Dim nWindEx As Database, tDef As TableDef
Dim dataSource As String
dataSource = "dBASE IV;" & _
    "DATABASE=C:\Program Files\Microsoft Office\Office"
Set nWindEx = Workspaces(0).OpenDatabase(Application _
    .DefaultFilePath & "\NWINDEX.MDB")
Set tDef = nWindEx.CreateTableDef("Orders2")
tDef.Connect = dataSource
tDef.SourceTableName = "Orders"
nWindEx.TableDefs.Append tDef
nWindEx.Close