Reputation: 189
I'm new in DataBases at all and have some difficulties with setting relationships between 3 tables in MS Access 2013.
The idea is that I have a table with accounts info, a table with calls related to this accounts and also one table with all the possible call responses. I tried different combinations between them but nothing works.
Upvotes: 0
Views: 2163
Reputation: 123409
To actually define the Relationships in Access, open the Relationships window...
... then follow the detailed instructions here:
How to define relationships between tables in an Access database
Upvotes: 0
Reputation: 13551
Using this table structure:
Accounts : AccountID(PK) | AccountName | Language | Country | Email
Calls : CallID(PK) | AccountID(FK) | ResponseID(FK) | Comment | Date
Responses: ResponseID(PK) | Response
Upvotes: 0
Reputation: 877
When you have a table, it usually has a Primary Key field that is the main index of the table. In order for you to connect it with other tables, you usually do that by setting Foreign Key on the other table.
Let's say you have your Accounts
table, and it has AccountID
field as Primary Key. This field is unique (meaning no duplicate value for this field).
Now, you have the other table called Calls
and you have a Foreign Key field called AccountID
there, which points to the Accounts
table.
Essentially you have Accounts
with the following data:
AccountID| AccountName | Language | Country | Email
1 | FirstName | EN | US | [email protected]
2 | SecondName | EN | US | [email protected]
Now you have the other table Calls
with Many calls
CallID(PK) | AccountID(FK) | ResponseID(FK) | Comment | Date
1 | 1 | 1 | a comment | 26/10
2 | 1 | 1 | a comment | 26/10
3 | 2 | 3 | a comment | 26/10
4 | 2 | 3 | a comment | 26/10
You can see the One to Many relationship: One accountID (in my example AccountID=1) to Many Calls (in my example 2 rows with AccountID=1 as foreign keys, rows 1 & 2) and AccountID=2 has also 2 rows of Calls (rows 3 and 4)
Same goes for the Responses
table
Upvotes: 1