編輯

共用方式為


Index object (ADOX)

Applies to: Access 2013, Office 2013

Represents an index from a database table.

Remarks

The following code creates a new Index:

Dim obj As New Index

With the properties and collections of an Index object, you can:

  • Identify the index with the Name property.

  • Access the database columns of the index with the Columns collection.

  • Specify whether the index keys must be unique with the Unique property.

  • Specify whether the index is the primary key for a table with the PrimaryKey property.

  • Specify whether records that have null values in their index fields have index entries with the IndexNulls property.

  • Specify whether the index is clustered with the Clustered property.

  • Access provider-specific index properties with the Properties collection.

Note

An error will occur when appending a Column to the Columns collection of an Index if the Column does not exist in a Table object already appended to the Tables collection.

Your data provider may not support all properties of Index objects. An error will occur if you have set a value for a property that is not supported by the provider. For new Index objects, the error will occur when the object is appended to the collection. For existing objects, the error will occur when setting the property.

When creating Index objects, the existence of an appropriate default value for an optional property does not guarantee that your provider supports the property. For more information about which properties your provider supports, see your provider documentation.