Sub exaCreateIndex()
Dim db As Database
Dim tdf As TableDef
Dim idx As Index
Dim fld As Field
Set db = CurrentDb
Set tdf = db.TableDefs!BOOKS
Set idx = tdf.CreateIndex("PriceTitle")
Set fld = idx.CreateField("Price")
idx.Fields.Append fld
Set fld = idx.CreateField("Title")
idx.Fields.Append fld
tdf.Indexes.Append idx
End Sub
|