>

Indexes Collection

Description

An Indexes collection contains all the stored Index objects of a TableDef object.

Remarks

Once created, a new Index object should be added to the TableDef object's Indexes collection using the Append method.

When accessing a table-type Recordset object, you specify the order of records using the object's Index property. Set this property to the Name property setting of an existing Index object in the Indexes collection. This collection is contained by the TableDef object underlying the Recordset object that you're populating. For example, to order your table-type Recordset by the ZIP_INDEX index, you could use the following code.


Set dbsBiblio = Workspaces(0).OpenDatabase("Biblio.mdb")
Set rstPublishers = dbsBiblio.OpenRecordset("Publishers", dbOpenTable)
rstPublishers.Index = "ZIP_INDEX"

Note

You can use the Append or Delete method on an Indexes collection only if the Updatable property setting of the containing TableDef object is True.

If you attempt to create an Index object and your data doesn't comply with the attributes specified for the index, such as nonunique or Null values in an indexed field, a trappable error results when you attempt to use the Append method on the new index.

Properties

Count Property.

Methods

Append Method, Delete Method, Refresh Method.

See Also

Appendix, "Data Access Object Hierarchy."

Example

See the Index object example.

Example (Microsoft Access)

See the Index object example (Microsoft Access).