>
Object | Usage |
Container | Read-only |
Database | Read-only |
Document | Read-only |
Field | |
Unappended | Read/write |
Appended to Index | Read-only |
Appended to QueryDef | Read-only |
Appended to Recordset | Read-only |
Appended to TableDef (native) | Read/write |
Object | Usage |
Field | |
Appended to TableDef (linked) | Read-only |
Appended to Relation | Read-only |
Group | |
Unappended | Read/write |
Appended | Read only |
Index | |
Unappended | Read/write |
Appended | Read only |
Parameter | Read-only |
Property | |
Unappended | Read/write |
Appended | Read-only |
Built-in | Read-only |
QueryDef | |
Unappended | Read/write |
Temporary | Read-only |
Appended | Read/write |
Recordset | Read-only |
Relation | |
Unappended | Read/write |
Appended | Read-only |
TableDef | Read/write |
User | |
Unappended | Read/write |
Appended | Read-only |
Workspace | |
Unappended | Read/write |
Appended | Read-only |
See Also CreateDatabase Method, CreateField Method, CreateIndex Method, CreateQueryDef Method. Example This example creates a TableDef object and then names it Parts ID.
Dim dbsNorthwind As Database, tdfPartsID As TableDef Set dbsNorthwind = DBEngine.Workspaces(0).OpenDatabase("Northwind.mdb") Set tdfPartsID = dbsNorthwind.CreateTableDef()
tdfPartsID.Name = "Parts ID" ... ' Create fields. dbsNorthwind.TableDefs.Append tdfPartsIDExample (Microsoft Access) The following example creates two new TableDef objects and names them. The name of the first TableDef object is included as an argument to the CreateTableDef method. The name of the second TableDef object is set using the Name property, after the TableDef object has been created. Note that you must define fields in the table before the TableDef object can be appended to the TableDefs collection.
Sub NameNewTables() Dim dbs As Database Dim tdfDefinitions As TableDef, tdfSynonyms as TableDef ' Return Database variable that points to current database. Set dbs = CurrentDb ' Create and name TableDef object. Set tdfDefinitions = dbs.CreateTableDef("Definitions") ' Create second TableDef object. Set tdfSynonyms = dbs.CreateTableDef("") ' Set Name property for second TableDef object. tdfSynonyms.Name = "Synonyms" . ' Create fields. . . dbs.TableDefs.Append tdfDefinitions dbs.TableDefs.Append tdfSynonyms End SubExample (Microsoft Excel) This example enters in the active cell on Sheet1 the name of the first recordset in the NWINDEX.MDB database. To create the NWINDEX.MDB database, run the Microsoft Excel example for the CreateDatabase method.
Dim db As Database, td As TableDef Set db = Workspaces(0).OpenDatabase(Application.Path & "\NWINDEX.MDB") Set td = db.TableDefs(0) Sheets("Sheet1").Activate ActiveCell.Value = td.Name db.Close