Unique

D

Dave

How do I create a unique composite index in an Access 2002 table?

IOW, I want to enforce uniqueness on the combination of two fields (e.g.,
OrderID, PartID in the OrdersParts table).

How do I do this?

I thought I could just create two indexes with the same name but on
different fields and then make them unique but this does not seem to work.
 
J

John Vinson

How do I create a unique composite index in an Access 2002 table?

IOW, I want to enforce uniqueness on the combination of two fields (e.g.,
OrderID, PartID in the OrdersParts table).

How do I do this?

Open the Table in design view. Select the Indexes tool (lightning
hitting a stack of horizontal rows).

Name an Index in the left column of the window that will pop up (it
should be a unique name within the table, though it needn't be unique
across the database); select the first field adjacent to it in the
right column, the next field below that in the right column - as many
as 10 fields can be included in an index.

Select the first row and specify that the index is unique.

Save the table (it may ask about checking the data, and object if
there are records which violate this uniqueness constraint; you'll
need to fix them).


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top