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 Masterchild Link
Michael Craytor 
     
11 months ago
I am using a subform with buttons on a main navigation form to navigate various records for a Customer. The buttons change what form is loaded in the subform control. This works great as long as the subform control only loads forms that contain CustomerID, because that's what Master-Child relationship is set to in design mode. But I have some tables that use a different ID name. And I have some tables with two possible IDs that could link to a customer (e.g., CustomerID, CustomerWhoReferredThemID). How can I dynamically control the master/child relationship of a subform control?
I've tried using VBA to force a change in the master/child relationship, but that did not work because the relationship could only be set during the OnLoad event, so repeatedly changing the relationship while navigating would not work without closing and reloading the navigation form for every button click. Unless there's another way? (fingers crossed someone has some ideas :) )
Kevin Robertson  @Reply  
          
11 months ago
Show us the code you used. You can definitely set the properties in a Button's Click event.
Michael Craytor OP  @Reply  
     
11 months ago
Sorry, cannot find the original code that first caused the problem. If I recall, I am able to set the relationship with VBA as long as the different subforms I am navigating all have a common field (e.g., all have a "CustomerID" field). Then, when changing the source for the subformcontrol, I can default the link to Me.ContactSubF.LinkChildFields = "CustomerID", and then change the childlink again after the new form is loaded if needed.
Otherwise, the hang-up occurs when it cannot change to a form without CustomerID while the .linkchildfields = "CustomerID", and it cannot change the .linkchildfields property to something else while the underlying form does not have 'something else'. So I get stuck where I cannot load the next form without first changing the child link, and I cannot change the child link before loading the next. I tried clearing the .linkchildfields property by setting it to "" or Null, but that did not work, however I was doing it. I don't remember what error I got then; I could try to recreate it.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

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: 5/21/2026 10:20:42 PM. PLT: 1s