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 ?
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 ?