B
Brett
Hello,
CreateNewIndex creates and sets an index to !MYTable.
However, !MYTable is deleted and recreated without the
indexes and I would like to recall CreateNewIndex to reset
the indexes. When I call CreateNewIndex again...it lets
me know the index already exist.
Is there an easy way to recall the DepartmentIndex
Sub CreateNewIndex()
Dim dbs As Database, tdf As TableDef, idx As Index
Dim fld1 As Field
' Return reference to current database.
Set dbs = CurrentDb
' Return reference to Employees table.
Set tdf = dbs.TableDefs!MYTable
Set idx = tdf.CreateIndex("DepartmentIndex")
Set fld1 = idx.CreateField("Department")
idx.Fields.Append fld1
idx.Required = True
tdf.Indexes.Append
Set dbs = Nothing
End Sub
CreateNewIndex creates and sets an index to !MYTable.
However, !MYTable is deleted and recreated without the
indexes and I would like to recall CreateNewIndex to reset
the indexes. When I call CreateNewIndex again...it lets
me know the index already exist.
Is there an easy way to recall the DepartmentIndex
Sub CreateNewIndex()
Dim dbs As Database, tdf As TableDef, idx As Index
Dim fld1 As Field
' Return reference to current database.
Set dbs = CurrentDb
' Return reference to Employees table.
Set tdf = dbs.TableDefs!MYTable
Set idx = tdf.CreateIndex("DepartmentIndex")
Set fld1 = idx.CreateField("Department")
idx.Fields.Append fld1
idx.Required = True
tdf.Indexes.Append
Set dbs = Nothing
End Sub