Sub List_Indexes()
Dim conn As New ADODB.Connection
Dim cat As New ADOX.Catalog
Dim myTable As New ADOX.Table
Dim idx As New ADOX.Index
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "Data Source=" & CurrentProject.Path & _
"\mydb.mdb"
End With
cat.ActiveConnection = conn
Set myTable = cat.Tables("Employees")
For Each idx In myTable.Indexes
Debug.Print idx.Name
Next idx
conn.Close
Set conn = Nothing
MsgBox "Indexes are listed in the Immediate window."
End Sub
|