multi field validation & duplicate prevention

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
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.
 

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

Similar Threads


Back
Top