How does Foreign Key get Updated

  • Thread starter R S via AccessMonster.com
  • Start date
R

R S via AccessMonster.com

I do not understand how Access relationships get updated. If I have a one to
many relationship and the same field in Table1.Sports as in Table2.Sports
then how do the records in table2 get updated. Do I need to input the
information in both tables manually (twice)?


For example, if I have the following two records (sports) in two different
tables:

Table1.Sports
Football
Soccer
Hockey

Table2.Sports
Football
Soccer
Hockey
Hockey
Hockey

How does Table2.Sports field get populated when I manually update Table1.
Sports by inputting new records?

I have never been able to understand how the foreign key gets updated.
Thanks.

Richard
 
R

Rick Brandt

R said:
I do not understand how Access relationships get updated. If I have
a one to many relationship and the same field in Table1.Sports as in
Table2.Sports then how do the records in table2 get updated. Do I
need to input the information in both tables manually (twice)?


For example, if I have the following two records (sports) in two
different tables:

Table1.Sports
Football
Soccer
Hockey

Table2.Sports
Football
Soccer
Hockey
Hockey
Hockey

How does Table2.Sports field get populated when I manually update
Table1. Sports by inputting new records?

It doesn't. What happens (if you have cascade deletes enabled) is that if
you delete "Football" from Table1 then Access will automatically delete all
of the records with "Football" in Table2.

Also (if you have cascade updates enabled) and you change "Football" in
Table1 to "Baseball" Access will automatically changes all instances of
"Football" in Table2 to "Baseball".

However; when you make NEW entries in Table1 Access does nothing to Table2.
Relationships never create new records in related tables. They can only
cause updates or deletions.
 
R

R S via AccessMonster.com

Thanks.

Rick said:
I do not understand how Access relationships get updated. If I have
a one to many relationship and the same field in Table1.Sports as in
[quoted text clipped - 18 lines]
How does Table2.Sports field get populated when I manually update
Table1. Sports by inputting new records?

It doesn't. What happens (if you have cascade deletes enabled) is that if
you delete "Football" from Table1 then Access will automatically delete all
of the records with "Football" in Table2.

Also (if you have cascade updates enabled) and you change "Football" in
Table1 to "Baseball" Access will automatically changes all instances of
"Football" in Table2 to "Baseball".

However; when you make NEW entries in Table1 Access does nothing to Table2.
Relationships never create new records in related tables. They can only
cause updates or deletions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top