Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear All Index's in a Table

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
In "vb code" i need to clear all index's in a table.

I then need to recreate new index's in the same table.
(Creating the new index's is no problem, i have written the code for this)
dbs.Execute "CREATE INDEX Indexa ON Drs " & "(Debtor, DebName);"

If someone has the time, i would appreciate some help with code to clear all the existing index's in a table. !!!

Regards Kennedymr2


 
Maybe these,
"DROP INDEX indexa ON DRS"
"ALTER TABLE DRS DROP CONSTRAINT indexa;"

Why are you concatenating?
Why not this?
dbs.Execute "CREATE INDEX Indexa ON Drs (Debtor, DebName);"


 
How are ya kennedymr2 . . .

In VBA help, have a look at the [blue]Indexes Collection![/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks for the replies.

Had a closer look at what i am trying to do !!@@

Probably need the code to get a list of index names in a table., then i can just delete the index's found.

Do not seem to be able to find this exact code.

I need to carry out this function, as i am importing from another format, and i get index's imported i do not need.


Appreciate any help

Kennedymr2
 
maybe a start...

Sub DAOIndex()
Dim ind As DAO.Index
Dim tbl As DAO.TableDef

For Each tbl In CurrentDb.TableDefs
If Left(tbl.Name, 4) <> "msys" Then
For Each ind In tbl.Indexes
Debug.Print ind.Name
Next
End If
Next

Set ind = Nothing
Set tbl = Nothing
End Sub
 
Zion7

Appreciate your help.

This has pointed me in the right direction., i now have it working ok.

Much appreciated.

Regards Kennedymr2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top