Get Access Database Schema - Primary Keys and Indexes

A

Arvin Meyer [MVP]

If you want something quick & dirty, I just cobbled this together:

Function GetIndexes()
' Arvin Meyer 2/4/2010
On Error Resume Next

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim idx As DAO.index

Set db = CurrentDb

For Each tdf In db.TableDefs
If Left(tdf.Name, 4) <> "Msys" Then
For Each idx In tdf.Indexes
Debug.Print tdf.Name, idx.Name
Next
End If
Next

Exit_Here:
Set db = Nothing
Set tdf = Nothing
Set idx = Nothing

End Function

If you want something more sophisticated, I wrote a dozen years ago that
adds them to a table.
 

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