Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Quick Access Question about Primary/Composit Keys

Posted on 2014-02-17
4
Medium Priority
?
359 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final pā€¦

636 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