Mega Code Archive

 
Categories / VisualBasic Script / Access
 

Adding a Multiple-Field Index to an Existing Table

Sub Add_MultiFieldIndex()    Dim conn As New ADODB.Connection    With conn       .Provider = "Microsoft.Jet.OLEDB.4.0"       .Open "Data Source=" & CurrentProject.Path & _           "\mydb.mdb"       .Execute "CREATE INDEX Location ON Employees (City, Region);"    End With    conn.Close    Set conn = Nothing    MsgBox "New index (Location) was created." End Sub