Benefits of a Primary Key

Have you ever placed an order with a company for the first time and then decided the next day to increase your order? You call the people at the order desk. Sometimes they ask you for your Customer Number. You tell them that you don't know your Customer Number. This happens all the time...

Sponsored Links:

Related Topics

Create a manageable database
I have an employee database that has way too many columns in it. In fact, soo many that I cannot add another. I need to figure out a way to break the information up but still be able to easily manage the data. I have been using queries to find the data I need but I know that there has to be a better way to house the info.

The database houses: pay, training, benefits, evaluation, and general data like address, etc. Should I create seperate tables for the specific areas ie Benefits, Pay, etc?

Also, is there a way to link two tables together so that information will auto-populate? Ex: I have an Employee table and a Benefits table. I want to be able to have the FirstName and LastName from Employee table to carry over into Benefits table as to not create duplicate entry. Is there a way to do so if it is linked to a primary key (EmpId


Error creating new primary key
I want to delete the primary key that is created when the database was first made and create another primary key from another column. I have followed the instructions in the help file and it looked to me that I had created the primary key that I wanted, but when I tried saving the file I got the following message: ".

created duplicated values in the index, primary key, or relationship." I am using Access 2007.


referential integrity and tables
I have several tables.
Let's say that Table1 is Inventory - it is a superclass table and contains inventory ids as its primary key and some other general info that applies to each inventory item.
Table 2 is Car that has primary key that is a foreign key from Inventory table.
Table 3 is Container that has primary key that is a foreign key from Inventory table.
Table 2 and Table 3 are subclasses, they are disjoint and total in my design. I linked primary keys in Table 2 and 3 to the primary key in Table 1, and MS Access placed 1:1 relationship.
I need it to be 0:1 or 1:1 relationship, so that record for Table 1 is always there for either table 2 or 3.
As of now, when I'm typing information with primary key "1" in Inventory, it asks for the records with primary key "1" in both tables Table 2 and 3.

How do I make it, so for example, Table 1 has keys 1,2,3 where key "1" and "2" are primary keys in Table 2, but key "3" refers to Table 3?

Is there anyway to do it just by leaving primary keys in Table 1 be a foreign key which is at the same time a primary key in Table 2 and 3 without creating a new attribute in Tables 2 and 3 which will be a separate foreign key for Table 1?


Create or remove a primary key
Every table in your database should have a primary key a field or set of fields with a unique value for each record stored in the table. You can use the primary key to identify and refer to each record.
Access can automatically create a primary key field for you when you create a table, or you can specify the fields that you want to use as the primary key. This article explains how and why to use primary keys.
One of the reasons to create a primary key is to use it to create table relationships.


Primary and Foreign key constraints
A primary key is a field or combination of fields that uniquely identify a record in a table, so that an individual record can be located without confusion.
A foreign key (sometimes called a referencing key) is a key used to link two tables together. Typically you take the primary key field from one table and insert it into the other table where it becomes a foreign key (it remains a primary key in the original table).


Primary key values fill in each seperate table automatically
I have the same primary key in of my tables I was wondering if there was a way to have the primary key field automatically update in of my tables if a value is entered into the primary key of another field? For example: Primary key is tag_number in all tables, in the general table I enter in the value XX01 and XX02 into the primary key field.

In the data table I want XX01 and XX02 to show up as records in the primary key field automatically.


Primary Key Change
Is it possible to change a primary key? when I initially selected the primary key, Now I've been asked (in a round about way) to changethe primary key but before I do I want to be sure it doesn't compromise the work I've done so far.

Is it as simple as changing the key and relationship table? Currently the key is set to "Yes (No Duplicates)" and the field I need to change the key to is also set as such.


Combo Box to look up records with compound/composite primary key.
I have a form whose datasource is a table that has two primary keys (that is, the combination of both fields make up the primary key for the record).

Both Primary Key fields have a format of Number/Double.

Primary Key #1 can be 9, 11, 12, and 13 digits long, and Primary Key #2 can be between 1 and 4 digits long.

I’d like to provide one combo box where the user would type in both keys together as one long number, and have the form return the appropriate record.

I’d also like to allow the user to select a record from the combo box, which is set up as two columns that show Primary Key #1 and Primary Key #2.


Edit primary key values
We have a multi-user database where the primary key is set to a meaningful text field. For many years, we have been happy with this and we never expected that the primary key values would have to be changed. Now however, there have been changes in gazetteer codes and as a consequence, the primary key values in the main table and a few related tables in our database will have to be changed.

My question is: is it OK to change these values with a series of update queries while keeping the primary key set on those table columns? (To avoid problems, we will run the update queries when no one else is logged onto the database, and after a backup of course.) Or should I temporarily take out the primary key and set it again after the updating is done?


Primary Key Reset
I have created a Database and Form for inputing to the database. I have entered information to test the rules and formats and now would like to start using the form but the primary key starts numbering where I left off even if I delete the rows of bogus information. How can I reset the primary key and have it start over at 1?

I removed the primary key, saved and readded the key but no luck.


Primary key default value
I would like to create a DB of Customer returns and so would like the Primary Key to be the individual number for each returned product. However, as the returns system is already in place(on a different DB system), I would like to start the records at 20000 (not #1 as dictated by the primary key), can I change the value of the first record to Number 20000in the primary key field and have it auto-increment with every record, as I can't seem to do this at the moment?


Join Key of table in recordset
im struggling my problem basically is when I create a form for my database and im creating it using 3 different tables so when ive finished it comes up with the error message cannot add record join key of TrackingRecord table not in recordset
The Tables and field Names are listed below
Students
StudentNo(Primary Key)
Surname
FirstName
TutorGroup
TrackingPoint
TrackingrecordID

Concern
ConcernNo (Primary Key)
StudentNo (Primary Key
ClassCode
Date
Concern?
Solution
Actionby?
SSA?
ReviewTeacher

TrackingRecord
StudentNo(Primary Key)
TrackingRecordID (Primary Key)
TrackingPoint
CWG


Which field of table is suitable for primary key?
Actually my question is in 2 parts:

* If | we have one table like below that we are sure 1 field of this table always | is unique we have to select that as primary key or we have to add one auto | number field for primary key?

Table:

Doc no | (PK), Text type
Title
Originator

Field I have selected for primary key is text type and some times around 50 characters. Now in my database that I have built before speed of some queries are very slow.
I do not know the problem is for primary key or no?

* If I | have to add new auto number field to my related tables and define new | primary keys how I have to that, because each of table has a lot of records?


Remove the Primary Key
A primary key in a relational database uniquely identifies each record. To remove the primary key in Access 2003, you first must familiarize yourself with the program's basic functionality. Read on to learn more.


Displaying primary key not text
I am a new Access user. The problem I am having is getting the data in a subform to display the text associated with the primary key rather than the primary key itself. In the subform StudentEnrolmentTable, faculty choose the CourseNumber from a combo box and the remianing associated fields are populated with and update querry. The problem is when the associated fields are viewed by faculy through the form, they are showing only primary keys and not the text the key is associated with


alphanumeric primary key
I am creating a data entry database for a client using Access 2003. They want there invoice number to be the primary key. It's alphanumeric. I have never created a primary key with a alpanumeric field. Can this be done effieciently? If so; how? What datatype to choose. This obviously has to be inputed not incremented correct


Selecting Primary Key Fields
Each database table must have a field or a combination of fields that holds a value that uniquely identifies each record. For example, a customer number would uniquely identify each customer. This field or fields are called the primary key of the table. The primary key serves several purposes in a RDBMS. Because the value is unique, it ensures there are no duplicate records in the database. The primary key is also used to establish table relationships and, thereby, connect the data in related records held in different tables. Records are stored in order by the primary key.


Add New Button Disabled
I have a form based on a query which is based on 13 tables. I have noticed that on the form, the add new button is disabled. Anybody have any thoughts?
The structure is as follows,

Main Table - Primary Key (ABC1)
Location1 Table - Primary Key (ABC1)
Location2 Table - Primary Key (ABC1)
Location3 Table - Primary Key (ABC1)
.

All the primary key fields are connected to the primary key in the Main Table.


Do I have to set the primary key to include primary key fields?
I have read that "in a junction table, you need to set the primary key to include the primary key fields from the other two tables. "

If I do this, I keep getting the error message "the change you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship.

The only way I'm entering data is through a form based on a query which automatically writes to all 3 tables (the junction and 2 parents) at once.

If I remove the primary keys in the junction tables, I no longer get the error message. Am I going to regret this later?


Relationship Query - ACCESS 2010
I have three tables in a database, one of which has a joint Primary Key. I've linked a table to the one with the joint Primary Key, and it says it's a 'One-to-Many' relationship. But Ithought that Primary Key to Primary Key was a One-to-One relationship?

Is it because a table with TWO Primary Keys is a different situation?