Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create an Index in Access table 2

Status
Not open for further replies.

MacroAlan

Programmer
Dec 4, 2006
134
US
I have a table that was created using the "Make Table" query.

Could I have added an index to one or more columns on the fly in VBA? Can I add the index afterwards?

I find vague references to the DDL but no code examples.


Alan

[smurf]
 
DoCmd.RunSQL "CREATE INDEX ...."

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Search Microsoft Office Access Help for the CREATE INDEX SQL statement.
 
You can also use TableDefs

[Code From MS Help] Set idxCountry = .CreateIndex("CountryIndex")
With idxCountry
.Fields.Append .CreateField("Country")
.Fields.Append .CreateField("LastName")
.Fields.Append .CreateField("FirstName")
End With
.Indexes.Append idxCountry[/code]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top