Benefits of a Primary Key
Thank you for taking the time to report an issue.
What's wrong... Please write below.
created duplicated values in the index, primary key, or relationship." I am using Access 2007.
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?
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.
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
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).
In the data table I want XX01 and XX02 to show up as records in the primary key field automatically.
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.
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.
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?
I removed the primary key, saved and readded the key but no luck.