Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim idxNew As DAO.Index
Set dbs = OpenDatabase("C:\yourdatabase.mdb")
Set tdf = dbs!yourtable
With tdf
' Create new index, create and append Field
' objects to its Fields collection.
Set idxNew = .CreateIndex("NewIndex")
With idxNew
.Fields.Append .CreateField("国家")
.Fields.Append .CreateField("姓氏")
.Fields.Append .CreateField("名字")
End With
' Add new Index object to the Indexes collection
' of the Employees table collection.
.Indexes.Append idxNew
.Indexes.Refresh
END WITH
[此贴子已经被作者于2003-6-12 9:07:32编辑过]
|