Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Automatically update a FK when a PK is updated

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nanette - 08 Nov 2006 23:47 GMT
Is it possible to make a FK in a child table update when the parent table has
a new record added. I'm looking to have the child FK updated when a Parent PK
is increased via autonumbering?

If this is possible, can you provide the code?
Damian S - 09 Nov 2006 00:14 GMT
Hi Nanette,

If you have the child table in a subform, and the parent table in the main
form with the field linking set correctly, Access will handle this
automatically for you.

If you are inserting a record a different way, you will need to insert the
key yourself.

Hope that helps.

Damian.

> Is it possible to make a FK in a child table update when the parent table has
> a new record added. I'm looking to have the child FK updated when a Parent PK
> is increased via autonumbering?
>
> If this is possible, can you provide the code?
Nanette - 09 Nov 2006 00:38 GMT
Damian,

What is field linking?

> Hi Nanette,
>
[quoted text clipped - 14 lines]
> >
> > If this is possible, can you provide the code?
Damian S - 09 Nov 2006 01:07 GMT
The bit on your form/subform that specifies which field on your main form is
the primary key, and which field in your subform is the foreign key.  Setting
these correctly will make Access handle your issue for you.

The field linking bits reside on the Data tab of the properties box of the
subform control on your main form.

Damian.

> Damian,
>
[quoted text clipped - 18 lines]
> > >
> > > If this is possible, can you provide the code?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.