473,425 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Foriegn Key update

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
4 1685
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
Turn on cascading updating and deleting

Nov 25 '05 #3
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Girish Agarwal | last post by:
Hi All, I have a database consisting of 2 tables. patient_info ( Patient Information ).Looks like lastname VARCHAR(10) fname VARCHAR(10) ssno INT(9) PRIMARY KEY ID INT(4) AUTO_INCREMENT ...
0
by: Girish Agarwal | last post by:
--0-474210375-1058976151=:31789 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Note: forwarded message attached. __________________________________
1
by: Bob | last post by:
Hi, Does anyone know why forgein key constraints are not enforced when updateing multiple tables using a combination of views and rules? This doesn't seem to be a major problem as I can...
0
by: David Allison | last post by:
Foriegn Key Required - Yes - no wonder it didnt work. Now they tell me. -- Dave Allison
0
by: Robert Fitzpatrick | last post by:
I have tblhud74b that has a foreign key to tblhudunits with Restrict Updates. I have a function that DELETEs corresponding records before doing an UPDATE right after the DELETE statement and...
0
by: Dev | last post by:
Hello all, I have a database system in which i truncate a main table to update the information. I would like to setup some foriegn keys referencing back to that table but am concerned as to how...
2
by: raghunana | last post by:
hello friends, i am a beginer.I was unable to add a foriegn key constraint to my NAMES table which refers my EMPLOYEE TABLE SQL> desc employee Name Null? ...
1
by: nads707 | last post by:
i hav following 2 tables n i am able to insert data into the second table having a foriegn key create table Customer_Details( Customer_ID integer primary key, Customer_First_Name varchar(75),...
1
by: Dev1 | last post by:
I have two tables, Company and Opportunity. Company table has two columns CompanyID (autonumber) primary key and Company. Opportunity table has OpportunityID (autonumber) primary key CompanyID ,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.