ListIndexes Method Example

This example creates a Snapshot listing all of the indexes in the Customers table of the BIBLIO.MDB database, then prints the Snapshot on the active form.

Dim ListSet As Snapshot, MyDB As Database, MyTable As Table
Set MyDB = OpenDatabase("BIBLIO.MDB")
Set MyTable = MyDB.OpenTable("Publishers")   ' Open Table.
Set ListSet = MyTable.ListIndexes()          ' Copy index info to ListSet.
MyTable.Close                                ' Close Table.
Do While Not ListSet.EOF
  Print ListSet("IndexName")
  Print ListSet("FieldCount")
  Print ListSet("IndexAttributes")
  Print ListSet("FieldName")
  Print ListSet("FieldOrder")
  Print ListSet("FieldType")
  Print ListSet("FieldAttributes")
  Print ListSet("FieldCollatingOrder")

ListSet might look like the following table.

Index              Field     Index                                 Field       Field    Field            Collating
Name              Count    Attributes    FieldName     Order      Type    Attributes    Order


PubID Name   2       0       PubID        0       4     0
PubID Name   2       0       Name         1      10     0         256
PrimaryKey   1       7       PubID        0       4     0