Keys I presume..<br>
This example sets the Unique property of a new Index object to True, and appends the Index to the Indexes collection of the Employees table. It then enumerates the Indexes collection of the TableDef and the Properties collection of each Index. The new Index will only allow one record with a particular combination of Country, LastName, and FirstName in the TableDef.<br>
<br>
Sub UniqueX()<br>
<br>
Dim dbsNorthwind As Database<br>
Dim tdfEmployees As TableDef<br>
Dim idxNew As Index<br>
Dim idxLoop As Index<br>
Dim prpLoop As Property<br>
<br>
Set dbsNorthwind = OpenDatabase("Northwind.mdb"

<br>
Set tdfEmployees = dbsNorthwind!Employees<br>
<br>
With tdfEmployees<br>
' Create and append new Index object to the Indexes <br>
' collection of the Employees table.<br>
Set idxNew = .CreateIndex("NewIndex"

<br>
<br>
With idxNew<br>
.Fields.Append .CreateField("Country"

<br>
.Fields.Append .CreateField("LastName"

<br>
.Fields.Append .CreateField("FirstName"

<br>
.Unique = True<br>
End With<br>
<br>
.Indexes.Append idxNew<br>
.Indexes.Refresh<br>
<br>
Debug.Print .Indexes.Count & " Indexes in " & _<br>
.Name & " TableDef"<br>
<br>
' Enumerate Indexes collection of Employees table.<br>
For Each idxLoop In .Indexes<br>
Debug.Print " " & idxLoop.Name<br>
<br>
' Enumerate Properties collection of each Index <br>
' object.<br>
For Each prpLoop In idxLoop.Properties<br>
Debug.Print " " & prpLoop.Name & _<br>
" = " & IIf(prpLoop = "", "[empty]", prpLoop)<br>
Next prpLoop<br>
<br>
Next idxLoop<br>
<br>
' Delete new Index because this is a demonstration.<br>
.Indexes.Delete idxNew.Name<br>
End With<br>
<br>
dbsNorthwind.Close<br>
<br>
End Sub<br>
<br>
<br>