See Also Example (Professional Edition Only)
Applies To
Index object.
Description
Determines which TableDef fields are key fields in an index Read-only when the Index is a member of a collection. Read/write only in the Professional Edition with a new object not yet appended to an Indexes collection.
Usage
index.Fields [ = fieldlist ]
Remarks
An Index object can have one or more fields representing key values for each record. Field names are separated by semicolons.
To get the fieldlist for an index, specify both the index and the recordset:
Key = Data1.Recordset.Indexes("PrimaryKey").Fields
With a data control, the Index must be a member of an Indexes collection. To get the value of this property, you can use the control's Recordset property, or you can use the TableDefs collection of the Database property of the data control. For example:
Key = Data1.Database.TableDefs("Areas").Indexes("PrimaryKey").Fields
In the Professional Edition, you can use an object variable You can create a new Index in a table by creating a new Index object, setting its properties, then appending it to the Indexes collection of the table's TableDef object.
Data Type
String
Help:
Append Method (Professional Edition Only)
Fields Collection
Indexes Collection
Name Property
New
Unique Property
Data Access Guide:
Chapter 2, "Database Management Using Visual Basic"
Fields Property Example (Professional Edition Only)
This example adds a new index to the Authors table.
Dim TempIndex As New Index ' Create new Index object.
TempIndex.Name = "Full Name" ' Set Index properties.
TempIndex.Fields = "LName; FName"
TempIndex.Unique = True
' Append the new Index to the Indexes collection.
MyDB.TableDefs("Authors").Indexes.Append TempIndex