Query design confusion when in a sub sub form (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 09:32
Joined
Dec 1, 2014
Messages
401
Hi.

I have a main form with 8 buttons on it and a child form. When i click each of the 8 buttons a different sourceobject is loaded in the child form.

One of the subforms loaded in this child form (frm_variety) contains within it a further subform (frm_varietysub). The recordsource for the frm_varietysub is a qry that uses a parameter textbox (txt_search) that is contained within Frm_variety.

Se attached image of query design.

If i open frm_variety outside of the main parent form the subform, Frm_varietysub loads fine. However if i load this form in the main parent form the popup please enter parameter box appears. No idea what i need to change in my query design to rectify the issue.
 

chrisjames25

Registered User.
Local time
Today, 09:32
Joined
Dec 1, 2014
Messages
401
Apologies. Here it is
 

Attachments

  • Query.JPG
    Query.JPG
    59.4 KB · Views: 145

theDBguy

I’m here to help
Staff member
Local time
Today, 02:32
Joined
Oct 29, 2018
Messages
21,357
Hi chris. You could try changing your reference to the subform in your query. You probably have one level of hiearchy in there, so it works when you open the form by itself. However, when the same form (with a subform) becomes a subform too, then you just added one more level to the hiearchy. Here's the typical syntax for it:


Forms!MainFormName.SubformControlName.Form!InnerSubformControlName.Form!ControlName


Hope it helps...
 

chrisjames25

Registered User.
Local time
Today, 09:32
Joined
Dec 1, 2014
Messages
401
Ok. Brilliant that makes sense. Couple of questions.

My main form is called "Hem Plan"
The child form within it is called "Frm_Sub1"
The sourceobject loaded in it is called "Frm_Main_Variety"
The subchild form within Frm_Main_Variety is called "child12"
The sourceobject loaded in it is called "Frm_Sub_Variety"

So guess question is do i use the source object name or the name of the actual "child" object?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:32
Joined
Oct 29, 2018
Messages
21,357
You would want to use the name of the subform control (object).
 

chrisjames25

Registered User.
Local time
Today, 09:32
Joined
Dec 1, 2014
Messages
401
Sorry to be stupid. But which one would be the subform control (object) out of child1 and the sourceobject within it named frm_test
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:32
Joined
Oct 29, 2018
Messages
21,357
It would be the "child1."
 

chrisjames25

Registered User.
Local time
Today, 09:32
Joined
Dec 1, 2014
Messages
401
Your a star. All sorted now. Many thanks for the above help. ONce followed what you stated above it worked a charm.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:32
Joined
Oct 29, 2018
Messages
21,357
Hi. You're welcome. Glad to hear you got it to work. Good luck with your project.
 

Users who are viewing this thread

Top Bottom