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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

item not found

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
BG
My function to remove index shows the error Item not found. Did i write it wrong?it is as follows and i call it with RemoveIndex "Pricelist", "code"
Sub RemoveIndex(strTable As String, strIndex As String)
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(strTable)
tdf.Indexes.Delete strIndex
Set tdf = Nothing
Set dbs = Nothing
End Sub
With the above function i want to delete the index in the field code.The field code has an indexed property set to Yes(Duplicates OK ) and i want to remove it. Why do i receive the error item not found ?






 
The code worked for me. I pasted it into Northwind and ran
Code:
 removeindex "customers", "City"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
You may simply try this:
dbs.Execute "DROP INDEX " & strIndex & " ON " & strTable & ";"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top