Parent/Child between Subforms

Pilotwings_64

Registered User.
Local time
Today, 04:51
Joined
Aug 20, 2010
Messages
14
Master/Child between Subforms

Let’s say that A is the mainform. B and C are subforms each within A. Neither B nor C are subforms within the other. Is it possible to create a Master/Child relationship in which a field within B is the Master and a field within C is the child?

If so, is it possible to accomplish this if both B and C are displayed in Datasheet view?

Thanks,
Justin
 
Last edited:
I have found some variety in the way Access responds to this structure.

This is the most reliable.
Place a textbox on the mainform with the control source as the subform field you want as the Master (=Forms!mainform.subformB.Form.fieldname). Then set this textbox as the MasterLinkField of the other subform control.

I have also seen it work another way but it can have problems at loading. I think it depends on the order of the subform loading so I don't really trust it.

SubformC MasterLinkFields: Forms!mainform.subformcontrolB.Form.fieldname
SubformC ChildLinkFields: fieldname
 
Thanks, I found a web site talking about that technique about two hours ago, but the code (if you can call it that) was not working. I see you have it written out differently.

I'll try it.

Thanks again,
Justin
 
Thanks a lot! That is exactly what I needed! You have solved my problem completely.

I have posted this on other forums and I would like to quote your solution. Do forums usually have a problem with posts that refer to "competitors"?

Thanks again,
Justin
 
Okay, I spoke too soon. I have the text box linked to the subform B. However, I can't seem to get that text box to become the Master of subform C's child.

How to I accomplish this?
 
Just use the name of the textbox on the mainform as the masterlink and the name of the field in the subform's recordsource as the Child.
 
I'll keep trying, but when I create the subform using the wizard, I don't get the option of using the text box as a Master. I uploaded the file incase you would like to take a look.

Thanks again,
Justin
 

Attachments

Just set up the subform with any link fields. Then open the properties window of the subform control and look at the Data tab.
Set the Master Link Fields and Child Link Fields.
 
You're right. I just did not know enough about access to link them. mike60smart from UtterAccess.com walked me through it last night, and it did work.

Thanks again for all the help. I would consider this solved.
 
It is a good idea to get familiar with the properties of Access objects and understand how to set them for various functionality. Wizards can be fast but they don't really help you understand the settings.
 
I agree. I just wanted to get my first database working first. Now that I have my database, I will have a much deeper understanding of what I will learn about access in the future. In my experience it's just best for me to dive right in, get a rough understanding of what I'm doing, and then start learning the details as soon as I have that. This way I quickly gain a better understanding of the context in which the things I am leaning exist.

I am very grateful to everyone who helped me. Basically, "diving right in" in this case meant imagining what I wanted, trying to do it myself and then asking for help when I came accross a problem. Luckily I only had one major problem. However, without all of you, I would still be stuck, trying to figure out how to link two subforms together. It might have been months before I solved it myself.

So three or four days ago I really didn't know anything about Access. Now I have what seems to me to be a reasonably complicated DB and a set of forms to interact with them, and I could reproduce them from scratch. I could not have reached this goal without help.

Thanks again, GalaxiomAtHome,
Justin
 

Users who are viewing this thread

Back
Top Bottom