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 / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

The best way to link subforms to main forms?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kjell Harnesk - 05 Dec 2005 18:51 GMT
I have a database with several tables, most of them are related to a "main"
table with a field ProjectNumber. What is the best/correct way to link
subforms based on the other tables to the main form wich is based on the
"main" table? I want the subforms to update when I change ProjectNumber on
the main form.
Signature

K in Sweden.

tina - 05 Dec 2005 20:02 GMT
each subform control has LinkChildFields and LinkMasterFields properties.
set the properties to the names of the foreign key/primary key fields
(respectively) that link the subform's underlying table to the main form's
underlying table.

hth

> I have a database with several tables, most of them are related to a "main"
> table with a field ProjectNumber. What is the best/correct way to link
> subforms based on the other tables to the main form wich is based on the
> "main" table? I want the subforms to update when I change ProjectNumber on
> the main form.
John Vinson - 06 Dec 2005 00:15 GMT
>I have a database with several tables, most of them are related to a "main"
>table with a field ProjectNumber. What is the best/correct way to link
>subforms based on the other tables to the main form wich is based on the
>"main" table? I want the subforms to update when I change ProjectNumber on
>the main form.

Depends entirely on how the Tables displayed on the form and subform
are related. If the mainform is based on your Projects table, and the
Subform (or subforms) on tables related one-to-many to the Projects
table, using the ProjectNumber as the foreign key, then simply set the
Subform's Master/Child Link Field to ProjectNumber. Some subforms
might be based on other tables with different relationships - but in
any case, the Master link field should be the field (or fields, for a
multifield key) constiting the "one" side table's link, and the Child
Link Field the corresponding field(s) in the related table.

Note that the subforms won't "update" in the sense of changing the
values stored on disk - but they will navigate to the related records
already stored on disk; and if you add a new record on a subform it
will automatically "inherit" the mainform's value of the linking
field, as the Child Link Field values will be filled in automatically
with the current record's Master Link Field.

                 John W. Vinson[MVP]    
 
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.