Form after Form after...

P

PeterM

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

Tom van Stiphout

On Tue, 23 Feb 2010 21:45:01 -0800, PeterM

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
 
Å

å¼ å°å»º

PeterM said:
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.
 
L

Larry Linson

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
 
P

PeterM

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



.
 
J

John W. Vinson

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

De Jager

PeterM said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top