How to update subform

B

BrianPaul

Taken from a previous post of exporting but ran into this problem:

I have a primary key that is a text field called Topic Subject. I then in my
othe table have the Topic Subject which is linked to the primary key.
However If I change the topic subject for example "How to build cars" and
change it to "How to build trucks" then the records in the subform that are
linked still think there linked to "How to build cars" Is there an after
update property in the forms field called topic subject after update that
will change the underlying records. Thanks.
 
R

Rob Parker

Hi Brian,

To do this, you must set a relationship between the tables, using the [Topic
Subject] field in each table. In the relationships window (from the Tools
menu), add both tables. Then drag the primary key field from the master
table onto the same field (the foreign key) in the sub-table to create a
link. In the dialog box that appears, set Enforce Referential Integrity
(which means that you cannot add a record to the sub-table unless a record
with that foreign key exists in the master table), Cascade Update Related
Fields (which will do what you want - change the data in the foreign key in
the sub-table when the primary key data changes in the master table), and
Cascade Delete Related Records (which will delete all records in the
sub-table with the foreign key when a record is deleted from the master
table - preventing orphan records in the sub-table).

HTH,

Rob
 
B

BrianPaul

Thanks

Rob Parker said:
Hi Brian,

To do this, you must set a relationship between the tables, using the [Topic
Subject] field in each table. In the relationships window (from the Tools
menu), add both tables. Then drag the primary key field from the master
table onto the same field (the foreign key) in the sub-table to create a
link. In the dialog box that appears, set Enforce Referential Integrity
(which means that you cannot add a record to the sub-table unless a record
with that foreign key exists in the master table), Cascade Update Related
Fields (which will do what you want - change the data in the foreign key in
the sub-table when the primary key data changes in the master table), and
Cascade Delete Related Records (which will delete all records in the
sub-table with the foreign key when a record is deleted from the master
table - preventing orphan records in the sub-table).

HTH,

Rob

Taken from a previous post of exporting but ran into this problem:

I have a primary key that is a text field called Topic Subject. I
then in my othe table have the Topic Subject which is linked to the
primary key. However If I change the topic subject for example "How
to build cars" and change it to "How to build trucks" then the
records in the subform that are linked still think there linked to
"How to build cars" Is there an after update property in the forms
field called topic subject after update that will change the
underlying records. Thanks.
 
G

Guest

BrianPaul said:
Taken from a previous post of exporting but ran into this problem:

I have a primary key that is a text field called Topic Subject. I then in
my
othe table have the Topic Subject which is linked to the primary key.
However If I change the topic subject for example "How to build cars" and
change it to "How to build trucks" then the records in the subform that
are
linked still think there linked to "How to build cars" Is there an after
update property in the forms field called topic subject after update that
will change the underlying records. Thanks.
 

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