From: John W. Vinson on
On Wed, 24 Feb 2010 08:34:04 -0800, PeterM <PeterM(a)discussions.microsoft.com>
wrote:

>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.

A Query has no referent for the Me. or Parent. keywords. These keywords are
only meaningful in VBA code on a Form - the query is off in a different
universe and has no way to know what you mean!

I would suggest simply using the Formdate control as the Master Link Field of
the subform, with PD_Date as the Child Link Field. If there already are
master/child link fields, just use both names, separated by semicolons.
--

John W. Vinson [MVP]
From: De Jager on

"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.