Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Get Index Information in MS Access 97 table

Author  Topic 

vk59
Starting Member

38 Posts

Posted - 2004-10-04 : 03:12:29
HI,
How can i retrieve the indexes information of a table in MS Access 97

In SQL Server 2000 we have a system table sysindexes. Do we have any table of that sort in MS Access 97

Thanks in advance
VK59

`

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-10-04 : 08:54:01
There are system tables in Access, you view them by making sure they are visible (Tools->Options->View->check off System Objects).

Not sure if indexes are stored in these tables though -- i suspect not.

YOu can use DAO to open a table and view the indexes; here's an example that enumerates all tables and indexes in your database. Note there's all kinds of properties for the indexes and columns you can view, not just the few I've shown here:


Sub testIt()
Dim t As TableDef
Dim i As Index
Dim f As Field

For Each t In CurrentDb.TableDefs
Debug.Print "Table: " & t.Name
For Each i In t.Indexes
Debug.Print " - Index: " & i.Name & ", Unique: " & i.Unique & ", Foreign: " & i.Foreign
For Each f In i.Fields
Debug.Print " - - Field: " & f.Name
Next
Next
Next

End Sub


You could easily set this up to populate your own SysIndexes table if you like .... That might be fun to write actually ... (again, unless this does exist somewhere already but I don't see it in the system tables in Access).

Other properties available in the index are Clustered, Primary, IgnoreNulls and Required. Yes folks, Access is a REAL database with clustered indexes and everything !

Let me know if this helps.



- Jeff
Go to Top of Page
   

- Advertisement -