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!

indexed property

Status
Not open for further replies.

peljo

Technical User
Mar 3, 2006
91
BG
What is wrong with my function to change index ? I want to change the indexed property of the field delays from the table visits but i do not know am i doing this properly.Could you help ? The field delays has the indexed property set to Indexed Yes(Duplicates OK) and i want to remove it with the function below
Public Function Cur()

Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim prp As DAO.Property
Dim idx As DAO.Index
Set tdf = dbs.TableDefs("visits")

Set idx = tdf.CreateIndex("delays")

idx.Unique = False
tdf.Indexes.Append idx

dbs.Close
Set prp = Nothing
Set idx = Nothing
Set fld = Nothing
Set tdf = Nothing
Set dbs = Nothing
End Function



 
Maybe you should

Code:
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim idx As DAO.Index

Set dbs = CurrentDb
Set tdf = dbs.TableDefs("visits")
With tdf
   Set idx = tdf.CreateIndex
   With idx
      .Name = "delays"
[b]      .Fields.Append .CreateField("[i]TableFieldToBeIndexed[/i]")[/b]
      .Unique = False
   End With
   .Indexes.Append idx
   Set idx = Nothing
End With

Set tdf = Nothing
Set dbs = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top