From: PeterM on
I have a mainform with a subform1 with a subform2 with a subform3. I need
subform3 to refer to formdate on subform2.

I've tried
=[forms]![mainform]![subform1].[form]![subform2].[form]![formdate]
=Forms!Mainform!Subform1.Form!Subform2.Form.formdate
=Me.Parent!RecordSource
=Me.Parent.Parent!RecordSource

I can't get anything to work.

Can someone tell me what I'm doing wrong.
From: Tom van Stiphout on
On Tue, 23 Feb 2010 21:45:01 -0800, PeterM
<PeterM(a)discussions.microsoft.com> wrote:

What I do is I "publish" the value from subform1 onto the parent, so
subform(i) can pick it up. I create a hidden textbox on the parent
form, with control source:
=Me.mySubformControl.Form.myControlOnSubform
Then in the next subform I refer to that control on the parent.

-Tom.
Microsoft Access MVP


>I have a mainform with a subform1 with a subform2 with a subform3. I need
>subform3 to refer to formdate on subform2.
>
>I've tried
>=[forms]![mainform]![subform1].[form]![subform2].[form]![formdate]
>=Forms!Mainform!Subform1.Form!Subform2.Form.formdate
>=Me.Parent!RecordSource
>=Me.Parent.Parent!RecordSource
>
>I can't get anything to work.
>
>Can someone tell me what I'm doing wrong.
From: 张小建 on


"PeterM" <PeterM(a)discussions.microsoft.com> 写入消息
news:EE6365FB-076C-496F-B34A-9B477EE06CF0(a)microsoft.com...
> I have a mainform with a subform1 with a subform2 with a subform3. I need
> subform3 to refer to formdate on subform2.
>
> I've tried
> =[forms]![mainform]![subform1].[form]![subform2].[form]![formdate]
> =Forms!Mainform!Subform1.Form!Subform2.Form.formdate
> =Me.Parent!RecordSource
> =Me.Parent.Parent!RecordSource
>
> I can't get anything to work.
>
> Can someone tell me what I'm doing wrong.

From: Larry Linson on
Am I correct that your main form contains a subform control #1, which
contains a form that contains a subform control #2, which contains a form
that contains a subform control #3, which contains a form in whose form
module the code will exist to refer to a control named "formdate" which
exists in the form contined in subform control #2?

If so then the code in the form contained in subform control #3 should be

Me.Parent.Form!formdate

You need to be very specific, lest we be confused. There is no Access object
called a Subform. There are Forms, and there are Subform Controls that can
exist on Forms. A Subform Control can contain a datasheet (I don't recommend
that) or a Form.

Larry Linson
Microsoft Office Access MVP




"PeterM" <PeterM(a)discussions.microsoft.com> wrote in message
news:EE6365FB-076C-496F-B34A-9B477EE06CF0(a)microsoft.com...
>I have a mainform with a subform1 with a subform2 with a subform3. I need
> subform3 to refer to formdate on subform2.
>
> I've tried
> =[forms]![mainform]![subform1].[form]![subform2].[form]![formdate]
> =Forms!Mainform!Subform1.Form!Subform2.Form.formdate
> =Me.Parent!RecordSource
> =Me.Parent.Parent!RecordSource
>
> I can't get anything to work.
>
> Can someone tell me what I'm doing wrong.



From: PeterM on
Your assumption is correct... I think. I have a mainform (Switchboard). On
Switchboard is a subform control containing a form (SubFormWindow). On
SubFormWindow there is a subform control containing a form
(ConsolidatedReview). On ConsolidatedReview there is a subform control
containing a form (Pain_Diary_Detail_Review). Pain_Diary_Detail_Review has a
query as the rowsource which is a query. ConsolidatedReview has a control
called FormDate. The Pain_Diary_Detail_Review query needs to refer to the
FormDate on ConsolidatedReview.

The query looks like this:
SELECT Pain_Diary.*
FROM Pain_Diary
WHERE (((Pain_Diary.PD_Date)=[me].[parent].[form]![formdate]))
ORDER BY Pain_Diary.PD_Date DESC;

I tried your suggestion and it's still prompting me for a parameter value
when the query runs. If I enter the date thru the prompt,
Pain_Diary_Detail_Review runs normally.

Thanks for taking time to review this...unfortunately it's still now working.
"Larry Linson" wrote:

> Am I correct that your main form contains a subform control #1, which
> contains a form that contains a subform control #2, which contains a form
> that contains a subform control #3, which contains a form in whose form
> module the code will exist to refer to a control named "formdate" which
> exists in the form contined in subform control #2?
>
> If so then the code in the form contained in subform control #3 should be
>
> Me.Parent.Form!formdate
>
> You need to be very specific, lest we be confused. There is no Access object
> called a Subform. There are Forms, and there are Subform Controls that can
> exist on Forms. A Subform Control can contain a datasheet (I don't recommend
> that) or a Form.
>
> Larry Linson
> Microsoft Office Access MVP
>
>
>
>
> "PeterM" <PeterM(a)discussions.microsoft.com> wrote in message
> news:EE6365FB-076C-496F-B34A-9B477EE06CF0(a)microsoft.com...
> >I have a mainform with a subform1 with a subform2 with a subform3. I need
> > subform3 to refer to formdate on subform2.
> >
> > I've tried
> > =[forms]![mainform]![subform1].[form]![subform2].[form]![formdate]
> > =Forms!Mainform!Subform1.Form!Subform2.Form.formdate
> > =Me.Parent!RecordSource
> > =Me.Parent.Parent!RecordSource
> >
> > I can't get anything to work.
> >
> > Can someone tell me what I'm doing wrong.
>
>
>
> .
>