DROP Index (1 Viewer)

MEDolin

Registered User.
Local time
Today, 10:49
Joined
Nov 6, 2001
Messages
17
Here is my problem...

I want to create indexed fields in a table after my data has been imported, but before the import starts I want to remove all existing indexes from previous imports. Do I have to do it individually on each index using the DROP statement or is there a way to remove all the indexes in table at once?

Thanks for your help!
 

Alexandre

Registered User.
Local time
Today, 16:49
Joined
Feb 22, 2001
Messages
794
Using SQL, I believe that you must write various DROP statements. This might be a case were you would like to use DAO:

tdfTemp.Fields.Delete strFieldName
or
tdfTemp.indexes.Delete (strIndexName)


Where tdfTemp is a tabledef object

Example:
Code:
Public Function trial()
Dim tbl As TableDef
Dim idx As Index


Set tbl = DBEngine(0)(0).TableDefs("TableA")


For Each idx In tbl.Indexes
   tbl.Indexes.Delete (idx.Name)
Next


End Function

Of course, it won t delete the index on th primary key of the table.

Alex

[This message has been edited by Alexandre (edited 03-13-2002).]
 

Users who are viewing this thread

Top Bottom