Solved

Quick Access Question about Primary/Composit Keys

Posted on 2014-02-17
4
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

691 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