Report with subreport with subreport in Access XP

P

Primoz Orehar

Hello!

I have a report with subreport and in this subreport is another subreport.
Now I don't know how to reference to a field on this subreport of subreport.
I need this because I'd like to sum first subsubsums and then add this to
subsums and so one.



Thanks and Best regards,

Primoz
 
A

Allen Browne

From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]
 
P

Primoz Orehar

I tryed this, but it's not working. Does this work by you? Do you have any
other suggestion?

Primoz

Allen Browne said:
From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I have a report with subreport and in this subreport is another subreport.
Now I don't know how to reference to a field on this subreport of subreport.
I need this because I'd like to sum first subsubsums and then add this to
subsums and so one.
 
A

Allen Browne

Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport control, and that
may be different to the name of the report that loads into the control (i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I tryed this, but it's not working. Does this work by you? Do you have any
other suggestion?

Primoz

Allen Browne said:
From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]


Primoz Orehar said:
I have a report with subreport and in this subreport is another subreport.
Now I don't know how to reference to a field on this subreport of subreport.
I need this because I'd like to sum first subsubsums and then add this to
subsums and so one.
 
P

Primoz Orehar

Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.

Does this really work?

I try also with code:



Dim subF1 As SubForm

Dim subF2 As SubForm

Dim subF1Controls As Controls

'Dim

'MsgBox CStr(Now())

Set subF1 = Me.Controls("Sub1")

Set subF1Controls = subF1.Controls

Debug.Print subF1Controls.Count

Debug.Print CStr(subF1.Controls.Count)

Debug.Print subF1.Name



strTemp = CStr(TypeName(Me.Controls("Sub1")))

strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name

'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)

Debug.Print strTemp

Debug.Print CStr(TypeName(Me.Controls("Sub1")))



But in the line:

Set subF1Controls = subF1.Controls

I get error:

Run-time error '2455'

You entered an expression that has an invalid reference to the property
Form/Report.



Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)

inside this subform (sub1).





Primoz Orehar; Slovenia, Europe


Allen Browne said:
Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport control, and that
may be different to the name of the report that loads into the control (i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I tryed this, but it's not working. Does this work by you? Do you have any
other suggestion?

Primoz

Allen Browne said:
From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]



I have a report with subreport and in this subreport is another subreport.
Now I don't know how to reference to a field on this subreport of
subreport.
I need this because I'd like to sum first subsubsums and then add
this
to
subsums and so one.
 
A

Allen Browne

The reference:
Me.Controls("Sub1")
refers to the subform control.

For the form within that control, you need to refer to the Form property of
the subform control, i.e.:
Me.Controls("Sub1").Form

Another example:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.

Does this really work?

I try also with code:



Dim subF1 As SubForm

Dim subF2 As SubForm

Dim subF1Controls As Controls

'Dim

'MsgBox CStr(Now())

Set subF1 = Me.Controls("Sub1")

Set subF1Controls = subF1.Controls

Debug.Print subF1Controls.Count

Debug.Print CStr(subF1.Controls.Count)

Debug.Print subF1.Name



strTemp = CStr(TypeName(Me.Controls("Sub1")))

strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name

'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)

Debug.Print strTemp

Debug.Print CStr(TypeName(Me.Controls("Sub1")))



But in the line:

Set subF1Controls = subF1.Controls

I get error:

Run-time error '2455'

You entered an expression that has an invalid reference to the property
Form/Report.



Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)

inside this subform (sub1).





Primoz Orehar; Slovenia, Europe


Allen Browne said:
Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport control, and that
may be different to the name of the report that loads into the control (i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I tryed this, but it's not working. Does this work by you? Do you have any
other suggestion?

Primoz

From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]



I have a report with subreport and in this subreport is another
subreport.
Now I don't know how to reference to a field on this subreport of
subreport.
I need this because I'd like to sum first subsubsums and then add this
to
subsums and so one.
 
P

Primoz Orehar

I have three objects:

1. SUBMAIN as root report

2. Sub1 As SubReport in control SUBMAIN_SubForm (Name of the control in
SUBMAIN form/report)

3. Sub2 As SubReport in control Sub1_SubForm (Name of the control in Sub1
form/report)



If I made reference to the control in Sub1 SubReport it works

When I made reference to the control in Sub2 SubReport I get error



First Reference: =Reports.SUBMAIN.SUBMAIN_SubForm.Form.SomeTextBoxSub1

Second reference:
=Reports.Submain.SUBMAIN_SubForm.Form.Sub1_SubForm.Report.SomeTextBoxSub2

I used Your MS-Access Tips for Casual Users link, but no luck



Are you maybe so kind that you send me an example, where all this works.



Primoz Orehar, Slovenia, Europe



Allen Browne said:
The reference:
Me.Controls("Sub1")
refers to the subform control.

For the form within that control, you need to refer to the Form property of
the subform control, i.e.:
Me.Controls("Sub1").Form

Another example:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.

Does this really work?

I try also with code:



Dim subF1 As SubForm

Dim subF2 As SubForm

Dim subF1Controls As Controls

'Dim

'MsgBox CStr(Now())

Set subF1 = Me.Controls("Sub1")

Set subF1Controls = subF1.Controls

Debug.Print subF1Controls.Count

Debug.Print CStr(subF1.Controls.Count)

Debug.Print subF1.Name



strTemp = CStr(TypeName(Me.Controls("Sub1")))

strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name

'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)

Debug.Print strTemp

Debug.Print CStr(TypeName(Me.Controls("Sub1")))



But in the line:

Set subF1Controls = subF1.Controls

I get error:

Run-time error '2455'

You entered an expression that has an invalid reference to the property
Form/Report.



Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)

inside this subform (sub1).





Primoz Orehar; Slovenia, Europe


Allen Browne said:
Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport control,
and
that
may be different to the name of the report that loads into the control (i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I tryed this, but it's not working. Does this work by you? Do you
have
any
other suggestion?

Primoz

From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]



I have a report with subreport and in this subreport is another
subreport.
Now I don't know how to reference to a field on this subreport of
subreport.
I need this because I'd like to sum first subsubsums and then
add
this
to
subsums and so one.
 
A

Allen Browne

http://allenbrowne.com/TempReportExample.zip

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I have three objects:

1. SUBMAIN as root report

2. Sub1 As SubReport in control SUBMAIN_SubForm (Name of the control in
SUBMAIN form/report)

3. Sub2 As SubReport in control Sub1_SubForm (Name of the control in Sub1
form/report)



If I made reference to the control in Sub1 SubReport it works

When I made reference to the control in Sub2 SubReport I get error



First Reference: =Reports.SUBMAIN.SUBMAIN_SubForm.Form.SomeTextBoxSub1

Second reference:
=Reports.Submain.SUBMAIN_SubForm.Form.Sub1_SubForm.Report.SomeTextBoxSub2

I used Your MS-Access Tips for Casual Users link, but no luck



Are you maybe so kind that you send me an example, where all this works.



Primoz Orehar, Slovenia, Europe



Allen Browne said:
The reference:
Me.Controls("Sub1")
refers to the subform control.

For the form within that control, you need to refer to the Form property of
the subform control, i.e.:
Me.Controls("Sub1").Form

Another example:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.

Does this really work?

I try also with code:



Dim subF1 As SubForm

Dim subF2 As SubForm

Dim subF1Controls As Controls

'Dim

'MsgBox CStr(Now())

Set subF1 = Me.Controls("Sub1")

Set subF1Controls = subF1.Controls

Debug.Print subF1Controls.Count

Debug.Print CStr(subF1.Controls.Count)

Debug.Print subF1.Name



strTemp = CStr(TypeName(Me.Controls("Sub1")))

strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name

'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)

Debug.Print strTemp

Debug.Print CStr(TypeName(Me.Controls("Sub1")))



But in the line:

Set subF1Controls = subF1.Controls

I get error:

Run-time error '2455'

You entered an expression that has an invalid reference to the property
Form/Report.



Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)

inside this subform (sub1).





Primoz Orehar; Slovenia, Europe


Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport control, and
that
may be different to the name of the report that loads into the control
(i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have
selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I tryed this, but it's not working. Does this work by you? Do you have
any
other suggestion?

Primoz

From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]



I have a report with subreport and in this subreport is another
subreport.
Now I don't know how to reference to a field on this subreport of
subreport.
I need this because I'd like to sum first subsubsums and then add
this
to
subsums and so one.
 
P

Primoz Orehar

Thank you for the link. And now I think that we talk about different kind of
reports.

I changed your report in to continuous report and know it doesn't work any
more.

Could you help me. I'd like to add sum on sub2 to sum on sub1.



Best regards

Primoz Orehar



Allen Browne said:
http://allenbrowne.com/TempReportExample.zip

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Primoz Orehar said:
I have three objects:

1. SUBMAIN as root report

2. Sub1 As SubReport in control SUBMAIN_SubForm (Name of the control in
SUBMAIN form/report)

3. Sub2 As SubReport in control Sub1_SubForm (Name of the control in Sub1
form/report)



If I made reference to the control in Sub1 SubReport it works

When I made reference to the control in Sub2 SubReport I get error



First Reference: =Reports.SUBMAIN.SUBMAIN_SubForm.Form.SomeTextBoxSub1

Second reference:
=Reports.Submain.SUBMAIN_SubForm.Form.Sub1_SubForm.Report.SomeTextBoxSub2

I used Your MS-Access Tips for Casual Users link, but no luck



Are you maybe so kind that you send me an example, where all this works.



Primoz Orehar, Slovenia, Europe



Allen Browne said:
The reference:
Me.Controls("Sub1")
refers to the subform control.

For the form within that control, you need to refer to the Form
property
of
the subform control, i.e.:
Me.Controls("Sub1").Form

Another example:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Yes. Now I named my forms with exactly the same names (sub1, sub2 and
SomeTextBox), but it's not working.

Does this really work?

I try also with code:



Dim subF1 As SubForm

Dim subF2 As SubForm

Dim subF1Controls As Controls

'Dim

'MsgBox CStr(Now())

Set subF1 = Me.Controls("Sub1")

Set subF1Controls = subF1.Controls

Debug.Print subF1Controls.Count

Debug.Print CStr(subF1.Controls.Count)

Debug.Print subF1.Name



strTemp = CStr(TypeName(Me.Controls("Sub1")))

strTemp = strTemp & vbCrLf & Me.Controls("Sub1").Name

'strTemp = strTemp & ", " & CStr(Me.Controls("Sub1").SomeTextBoxSub1.Name)

Debug.Print strTemp

Debug.Print CStr(TypeName(Me.Controls("Sub1")))



But in the line:

Set subF1Controls = subF1.Controls

I get error:

Run-time error '2455'

You entered an expression that has an invalid reference to the property
Form/Report.



Do you know how I can reference to the subfrom object (sub1) (or on any
object ) and how I can reference to the subform object (sub2)

inside this subform (sub1).





Primoz Orehar; Slovenia, Europe


Did you replace "Sub1" with the name of your subreport control?
And Sub2 with the name of the lower level subreport control?

Please note that you need to use the Name of the subreport
control,
and
that
may be different to the name of the report that loads into the control
(i.e.
its SourceObject). To check the name:
- Open the main report in design view.
- Right-click the edge of the subreport, and choose Properties.
- Check that the Title Bar of the Properties Box indicates you have
selected
the subform/subreport control.
- Check the Name property on the Other tab.

Repeat for the lower level subreport.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I tryed this, but it's not working. Does this work by you? Do
you
have
any
other suggestion?

Primoz

From the main report the reference would be something like this:
=[Sub1].[Report]![Sub2].[Report]![SomeTextBox]



I have a report with subreport and in this subreport is another
subreport.
Now I don't know how to reference to a field on this
subreport
of
subreport.
I need this because I'd like to sum first subsubsums and
then
add
this
to
subsums and so one.
 
A

Allen Browne

Primoz, I cannot develop your application for you for free.
There is no such thing as a "continuous report".
You have a working example, and an explanation of how and why you need to
use the ".Report" bit.
 

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