Solved

Quick Access Question about Primary/Composit Keys

Posted on 2014-02-17
4
346 Views
Last Modified: 2014-02-17
I have a table in access and I need to prevent duplicates when two of the fields are duplicated.

So, if just one of them is repeated it is fine. The problem is when a combination of fields are duplicated. Example:

Fields: Lname, Fname, DOB

It is okay if any of those are duplicated on their own. But if Lname and Fname, or Lname and DOB match another record in the table, the table should reject the new record.
0
Comment
Question by:Megin
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 39866224
Are you wondering how to do that, or if you can have both with the same field (Lname)? Or have two composite keys, with no duplicates?
0
 

Author Comment

by:Megin
ID: 39866231
I am wondering how to do that with Access. I see that I can set a particular field to not accept duplicates and I could set others to not accept duplicates, but I want to make it so that the combination of two fields won't accept duplicates.
0
 
LVL 26

Accepted Solution

by:
jerryb30 earned 500 total points
ID: 39866240
Go into table design.
Select View
Indexes
On an empty index name line, create a new index name
On that line, and as many other lines as required, add the field names
Go back to the line with index name, select that, and change the index property to Unique
example
0
 

Author Closing Comment

by:Megin
ID: 39866254
Perfect!  Thank you!

I would not have found that on my own.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now