By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,453 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,453 IT Pros & Developers. It's quick & easy.

Foriegn Key update

P: n/a
Hi,

I am a form which has a sub form,

The sub form is linked with primary key of main form as a foriegn key
in sub form, very basic,

In the main form, I have another field which is investor, and in the
sub form, I have created investory foreign key, this is the second link
between main form and subm form.

When i first enter the record, both the primary keys are updated in the
sub form and it works fine.

However, if later I have to go adn change the investor (which is a
requirment) the forien key in the sub form do not get updated, it still
show old invenstory.

May be one way of doing is to have an event procedure, on the after
update of investory field in the main form, which should go to sub form
and update the investory foreign key to correct investor.

Can someone please help me with sample code? or sugguest a better way
of doing this.

Thanks and Regards, Irf.

Nov 25 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 25 Nov 2005 05:04:26 -0800, ir**@emirates.net.ae wrote:
Hi,

I am a form which has a sub form,

The sub form is linked with primary key of main form as a foriegn key
in sub form, very basic,

In the main form, I have another field which is investor, and in the
sub form, I have created investory foreign key, this is the second link
between main form and subm form.

When i first enter the record, both the primary keys are updated in the
sub form and it works fine.

However, if later I have to go adn change the investor (which is a
requirment) the forien key in the sub form do not get updated, it still
show old invenstory.

May be one way of doing is to have an event procedure, on the after
update of investory field in the main form, which should go to sub form
and update the investory foreign key to correct investor.

Can someone please help me with sample code? or sugguest a better way
of doing this.


Since you say that it works fine with respect to initial entry,
something is working. It would seem to me that tweaking that would be
the best way to go.

So, more information, please.

There are two ways to have a subform's recordsource update. One is
through the built=in Access method of linking the master and child
links. The other way is to set the recordsource yourself, either once
(assuming it is static) or dynamically.

Which of these three options have you chosen? Show the details of
what you have chosen so far.

mike
Nov 25 '05 #2

P: n/a
Turn on cascading updating and deleting

Nov 25 '05 #3

P: n/a
Create a link between the tables and ensure that Cascade Related Fields is
switched on.

--
Terry Kreft

<ir**@emirates.net.ae> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,

I am a form which has a sub form,

The sub form is linked with primary key of main form as a foriegn key
in sub form, very basic,

In the main form, I have another field which is investor, and in the
sub form, I have created investory foreign key, this is the second link
between main form and subm form.

When i first enter the record, both the primary keys are updated in the
sub form and it works fine.

However, if later I have to go adn change the investor (which is a
requirment) the forien key in the sub form do not get updated, it still
show old invenstory.

May be one way of doing is to have an event procedure, on the after
update of investory field in the main form, which should go to sub form
and update the investory foreign key to correct investor.

Can someone please help me with sample code? or sugguest a better way
of doing this.

Thanks and Regards, Irf.

Nov 25 '05 #4

P: n/a
No, you would turn on cascade delete if you want to delete child records
when the parent record is deleted, that is not what is being asked for.
--
Terry Kreft

"Beacher" <be*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Turn on cascading updating and deleting

Nov 25 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.