Access: Names of Indices
I have a Microsoft Access Database and I need to execute a statement :
**DROP INDEX Name ON Installations
However, Microsoft Access says that no such index name found. The column "Name" in the Installations table does have an index on it . I know this from the Access GUI . However, I ca开发者_StackOverflow社区n't use the ACCESS GUI to turn off the index ( I have to do the task by using the OleDbConnection class from a C# program - I'm writing a database upgrader ) .
Any ideas ? How do I get a list of of names of indices for a given table in Access ?
All the best, Seb
Here's how I found it.
- Open the table design.
- Right click on the Title Bar
- Select Indexes
So in my example above, I would use:
drop index primarykey on bar
VBScript suit?
Dim objEngine ''As DAO.DBEngine
Dim db ''As DAO.Database
Dim tdf ''As DAO.TableDef
strDAOversion = "DAO.DBEngine.36"
Set objEngine = WScript.CreateObject(strDAOversion)
Set db = objEngine.OpenDatabase("c:\Docs\db.mdb")
Set tdf = db.TableDefs("ATable")
For Each ndx In tdf.Indexes
s = s & vbCrLf & ndx.Name
Next
MsgBox s
精彩评论