# Linking Access Tables



## sstasiak (Feb 6, 2007)

Hello all

I am trying to link 2 tables in Access and have run into some problems. I have one table(OncTbl) that has an autonumber primary key field named ID that I need to link to another table(WeightDate) that contains ID, date, and weight fields. 

Each record in OncTbl will have multiple entries associated with it in the WeightDate table. I want the ID field in WeightDate to be assigned the same number as the primary key ID in OncTbl. So there will be duplicate ID's in WeightDate table that will match up with the associated record ID in OncTbl.

Can anyone help me out? I hope my explanation is clear enough


----------



## skipidybebop (Feb 16, 2007)

Microsoft Access allows you to create different types of relationships between tables. The relationship you are trying to create is a "one-to-many" relationship. One record in the parrent table is linked to many records in the child table.

The sample database that ships with Microsoft Access contains an exellent example of this type of relationship. 1 record in the customers table is linked to many records in the orders table.

The duplicate field in the child table must NOT be set to primary key or unique in order to achieve your goal. This will allow for multiple records in the child table to be assosiated with the same (but unique) field in the parent table.

The relationships view in Microsoft Access confirms the assosiation and relationship type by placing either a 1 or a ~ next to the applicable fileds in both the parent and child tables, inficating a one (1) to many (~) relationship.

The clever bit is to hide the linking field in the child table from view so the records just look like their attached in some way. If you do your form or query correctly the user should never have to complete this field.

Hope this helps you.


----------

