multi field validation & duplicate prevention

V

Viraj Oza

I am creating a database where by i have 2 particular fields - Company and
Customer. I can have many entries from the same company but not of the same
customer more than once.

I would like to find out how to prevent duplicate entries of both fields for
example Company: Texaco, Customer Bill Jones.

So Basically not enter the same company & customer together twice.
 
A

Allen Browne

You can ensure uniqueness by creating an index on the combination of the 2
fields.

1. Open your table in design view.

2. Open the Indexes box (View menu.)

3. On a new row in the indexes dialog, enter a name for the index, and the
first field. Example:
CompanyCustomer Company

4. On the next row, leave the index name blank (becuase it's part of the
same index), and enter just the 2nd field:
Customer

5. In the lower pane of the dialog, set Unique to Yes.

6. Save.
 
K

KARL DEWEY

Open the table in design view. Highlight the two fields and click the Key
icon. This set a unique index of the two field combination.
If you cannot save due to violations you will need to find where you
currently have duplicates first.
 
Top