View Single Post
  #4  
Old October 31st, 2009, 12:51 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Relationships bwtween more than one table

On Tue, 27 Oct 2009 16:23:41 GMT, "f123 via AccessMonster.com" u50920@uwe
wrote:

am working now on one database where i have 5 tables, each record from one
table is related to one another in other table with One to Many Relation

in other words, each record from one table may has many records on the next
table

Example:

Tbl 1 ...Project
Tbl 2....Activity
Tbl 3...Description
...
...and so on

now Project May has Many Activity
the Activity May has Many Description
and the Description may has Many Records


Tbl1 (let's call it Projects, meaningful object names are easier to
understand) should have a Primary Key field. Let's call it ProjectNo.

Tbl2 - Activities - should have a Primary Key, ActivityID; it should also have
a field ProjectNo, of the same datatype and size as the ProjectNo field in
Projects; this field is called a "foreign key".

Tbl3 - Description - should have a Primary Key, DescriptionID, and an
ActivityID field matching Activities.ActivityID. If Activities.ActivityID is
an Autonumber, then Description.ActivityID should be a Long Integer.

You would use the Relationships window to define a relationship from Projects
to Activities, on ProjectNo; and from Activites to Description, on ActivityID.

To see data from all three tables on a form, you can use a Form based on
Projects, with a Subform based on Activities (for simplicity this form should
be in Single Form view, not datasheet or continuous; on the subform you could
have a subform (a sub-subform to be precise), based on Description. This could
be a Continuous Form if you want to see multiple descriptions at once. It
would use ActivityID as its master/child link field.
--

John W. Vinson [MVP]