Composite uniqueness on 2 fields

R

Razor

Hi,

I need to set up a table's properties such that two fields
are together unique.

Is there a way to do this in the table's design view
except for creating a composite primary key on the two
fields?

I guess it's a validation rule that would prevent data
entry if the rule were violated.

If this can only be enforced through a form, then can
someone show me the form-code to do this?

Thanks!

Regards,
Razor
 
B

Brian Camire

You can create a unique index on these two fields. This unique index does
not have to be the primary key. To do this:

1. Open the table in Design view.

2. From the View menu, choose Indexes to display the Indexes window.

3. In the first blank row in the Indexes windows, type a name for the index
in the Index Name column.

4. Set the Unique property of the index to Yes.

5. In the Field Name column of the same row, select the first field for the
index.

6. In the next row in the Field Name column, select the second field for
the index. Leave the Index Name column blank in that row.
 

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