Topics Search

Benefits of a Primary Key

Benefits of a Primary Key
Views: 23
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:

Similar posts...


Error creating new primary key

Error creating new primary key Icon
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

referential integrity and tables Icon
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

Create or remove a primary key Icon
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

Primary and Foreign key constraints Icon
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

Primary key values fill in each seperate table automatically Icon
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

Primary Key Change Icon
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.

Combo Box to look up records with compound/composite primary key. Icon
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

Edit primary key values Icon
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

Primary Key Reset Icon
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

Primary key default value Icon
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?