Index Name(s)

E

easoftware

I am using Access 2003

Is there a way to use SQL to get the Index Names on a table?

I can get the data if I go to Tools->Analyze->Documenter, select the
"Tables" tab, select the table I want and then click OK. A report is
displayed in a window. I am using the data in the "Table Indexes"
section

Can I use SQL to get this information, if I know the table name?

Thanks
 
A

Allen Browne

You can get at the indexes and their properties through DAO.

The core idea (aircode) is:
Dim db As DAO.Database
Dim tdf As DAO.Tabledef
Dim ind As DAO.Index

Set db = CurrentDb
For Each tdf in db.TableDefs
For each ind in tdf.Indexes
Debug.Print ind.Name
next
Next

You probably want to skip the tables where the name starts with "~", or
(tdf.Attributes And dbSystemObject) <> 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top