Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating tables with relationships

Status
Not open for further replies.

lasd

Programmer
Jan 14, 2005
48
0
0
IE
Hi
I'm a little bit confused here folks. I have to create a database with three tables. These three tables must be linked together.
1st table is called company. it contains the columns Name, Description, Mvalue, T-ID(this column will be linked with the next table)
2nd table is called TT and it contains columns T-ID, Date and description.

These two tables will be linked by a one to many relationship. There could be many company's with the same T-ID.....

is it possible for me then to link the TT table with a new TT2 table and have the history of the T-ID stored in this third table. When I say a history I mean that this TT2 table will show the history of each T-ID.

hope i am being clear enough

thanks a mill in advance for your help.
 
lasd

Since you know what you want, the best answer would come from you determining what your needs. Here is some reading about database design and relationships....

Fundamentals of Relational Database Design
Download document
Read on-line (HTML)

Micro$oft's answer...
283878 - Description of the database normalization basics
304467 - ACC2000 Defining Relationships Between Tables in a Microsoft Access Database

...Moving on

A key part of about design and relationships is the primary key and the foreign key.

Primary key:
As part of normalization, each record requires a primary key to uniquely identify the record.

Foreign key:
In the related table on the "many" side (which will have it's own primary key), it will store the primary key from the "one" side as a foreign key.

In your example,

tblComany
T_ID - primary key
CompanyName
...plus other fields

tblTT
TT_ID - primary key
T_ID - foreign key to tblCompany
...plus other fields

...Moving on - Naming convention issues
- It is advisable not to use "reserved" names when naming the fields in your table. Examples: Name, Date
- It may be better to use underscore "_" instead of the dash "-". The reason is that Access can treat the TT-ID as TT minus ID.

Richard
 
Thanks Richard for your reply to that email. I have built my tables and my relationships are set up now.
I now have a problem with calculations. i will give you an example of what i am trying to do.

Table1
lets say it has three colums.
AE = 2.000
RAE= 2.000
APPE= this column is equal to the square root of AE to be squared and RAE to be squared.

Could you help me on doing this calculation and how i get the result of that sum to appear in the APPE column on my Table1.

Also if i want to include other tables and columns in these calculations how do i do this?

Thanks in advance for your help. It is greatly appreciated.

Kindest regards

LASD

 
lasd, there are several ways to accomplish this. One is to do the calculations within a module using sql statements. For example use a SELECT sql statement to retrieve the first two columns, then perform the calculation inside a subroutine, and then use an UPDATE sql statement to add the value to the third column.
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top