Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Call this function to add an index to a table.

void CreateIndex( 
   CDaoIndexInfo& indexinfo  



A reference to a CDaoIndexInfo structure.

Indexes specify the order of records accessed from database tables and whether or not duplicate records are accepted. Indexes also provide efficient access to data.

You do not have to create indexes for tables, but in large, unindexed tables, accessing a specific record or creating a recordset can take a long time. On the other hand, creating too many indexes slows down update, append, and delete operations as all indexes are automatically updated. Consider these factors as you decide which indexes to create.

The following members of the CDaoIndexInfo structure must be set:

  • m_strName   A name must be supplied.

  • m_pFieldInfos   Must point to an array of CDaoIndexFieldInfo structures.

  • m_nFields   Must specify the number of fields in the array of CDaoFieldInfo structures.

The remaining members will be ignored if set to FALSE. In addition, the m_lDistinctCount member is ignored during creation of the index.

Community Additions

© 2015 Microsoft