Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Dynamic Subform With Multiple Links
Mohammed Alateyah 
     
10 days ago
I have a form which is products form and I want to show dynamic subform which will open either inspection form or lab sampling form I saw you using a similar trick in your association series now to just make the dynamic subform is straight forward but I want the subform to show only related records however both forms should link to the main form different field where the inspection form link to the parent using product number while the lab testing form link to the parent using the raw material number I want to know how can I handle this situation in a scalable way especially if they could be three forms and more in which I need to change parent child relation each time I change the form.  

Note:

Currently I am using a combo box that will give the code which form I want to open
Donald Blackwell  @Reply  
       
10 days ago
Hi Mohammed ,

Customizing Master/Child fields is also very easy and can be done from within the Combo Box that you have.

For example, if your combo box is built from a value list with a rowsource similar to:

"InspectionF";"Inspections";"SamplingF";"Lab Sampling"

Just add 1 or 2 more hidden columns to the value list. These would hold the name of the Link Master Field and Link Child Field field name(s) so it might look like:

"InspectionF";"Inspections";"InspectionID";"SamplingF";"Lab Sampling";"SamplingID" --- if both forms use the same field name
With column count of 3 and widths like: 0;1;0
-- or --
"InspectionF";"Inspections";"ProductInspectionID";"InspectionID";"SamplingF";"Lab Sampling";"ProductSamplingID";"SamplingID" --- if different field names are used
With column count of 4 and widths like: 0;1;0;0

Then your combobox after update event would include something like:

SubFormName.SourceObject = ComboBoxName.Column(0)
SubFormName.LinkMasterFields = ComboBoxName.Column(2)
SubFormName.LinkChildFields = ComboBoxName.Column(2)


If the field names are different between the master and child forms, change the LinkChildFields to ComboBoxName.Column(3)

Mohammed Alateyah OP  @Reply  
     
4 days ago
Thanks a lot Mr. Blackwell I appreciate your reply it was helpful and I could use it to build my dynamic sub form thanks a lot
Richard Rost  @Reply  
           
4 days ago
Looks like you got a good solution working - glad to hear it, and thanks to Donald for laying out that approach. The key trick here is storing the form name and both link field names in your combo box's Row Source, so when you switch forms, you can dynamically set both the SourceObject and the link master/child fields in code. This scales well even if you add more subform types later - just add additional rows to your combo's value list, keeping the master/child link info for each. As your app grows, you might want to move this info to a table instead of a value list for easier maintenance. Keep making regular backups as you experiment with the design - Access can get a little cranky with dynamic forms sometimes.
Add a Reply Upload an Image
Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/29/2026 11:25:24 PM. PLT: 1s