Solved

Quick Access Question about Primary/Composit Keys

Posted on 2014-02-17
4
347 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

786 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