creating a multiple field key index in access 2007

D

dennist685

I've searched the kb without an answer. Can somebody help? It's got to be
easy.

dennist685
 
A

Allen Browne

If the fields are contiguous, open the table in design view, select the
multiple fields at once (using the "record Selecter" to the left of the
field name), and click the Key icon on the toolbar.

If the fields are spread apart, or you want the index in a different order,
open the Indexes dialog (View menu, in table design). Enter a name for the
index in the first column, and the first field beside that. On subsequent
lines of the dialog, leave the Index Name column blank (indicating this row
is part of the same index above), and enter the field name. The dialog will
look something like this:
Index Name Field Name Sort Order
========= ======== =======
PrimaryKey CompanyName Ascending
City Ascending
State Ascending

If you wanted to create the index programmatically instead of via the
interface, see these examples:
http://allenbrowne.com/func-DAO.html#CreateIndexesDAO
http://allenbrowne.com/func-ADOX.html#CreateIndexesAdox
 
Top