Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sub report fields 2

Status
Not open for further replies.

GShen

MIS
Sep 26, 2002
561
US
Hi,
How do I or can I get data from my subreport back onto the main report. I have a footer break on the main report. Above it I have 2 sub reports with totals on them. I need those 2 totals to be added to the one I already have on the main report. I tried referecing by =Reports!MAINREPORT!SUBREPORT.Reports!FieldnamefromSUBREPORT but I keep getting an error saying it cannot find SUBREPORT.

Can you do this?

Remember when... everything worked and there was a reason for it?
 
Hi
=[SubFormControlName]![ControlName]
Seems to work for me.
 
I would use:
=SubrptName.Report.txtControlFromSubreport
Make sure the name of the text box is not the name of a field. I also think the subreport control and the text box should be in the same section of the report.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Remou,
Do you mean =[SubFormName]![controlname] ?

Remember when... everything worked and there was a reason for it?
 
Hi
No, I don't. I can have a subform control named one thing, containing a report named something else. So, I mean the name of the control that contains the subform. :)
 
Duane,
I am fried. They are in the same section. In other words the total I want to print is in the same section of the subreport. It am still however getting an error
COLUMN (My subreport name is here) DOES NOT EXIST IN THE APPROPRIATE ROW SET.

Remember when... everything worked and there was a reason for it?
 
Hi
Just an additional note,
=[SubFormControlName]![ControlName]
Works for me even if the subreport is in the footer or on the next page.
 
Remou,
I am missing something here.
If the name of my main report is "ReportMain".
If the name of my sub report is "ReportMainSub".
If I have a field on the sub report called txtQty.
I want to get that qty on my main report. I created an unbound field. I am trying to set the control source to access the txtQty field on the sub report.
Before you wonder why I am trying to do this. I have a total on my main report, I have a total on each sub report.
I need to print all the numbers combined on my report break.

What is the exact syntax. I am confused with
=[SubFormControlName]![ControlName]

Remember when... everything worked and there was a reason for it?
 
Hi
For the most part the subreport control has the same name as the subreport it contains, but sometimes it does not. This would happen if, for example, you set the Source Object of the subreport control called "MySubForm Subform" to Report.MyReport. The name of the subform control is the name that appears with other subform control properties, such as link child fields / link master fields.
You, I think have a field called txtQty on your subform footer, containing a total. Let us say your subform control is called MySub Subform, set an unbound text field on the main form to:
=[MySub Subform]![txtQry]
I hope I am explaining this properly, I have tested this, just now. [3eyes]
 
I would try:
=ReportMainSub!Report!txtQty

This assumes the Name property of your subreport control is "ReportMainSub". As Remou suggested this is not always the case but is the default behaviour when you add a subreport to a main report.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Everyone,
THANKS! Like I said, I was fried. I had the name of the control on the sub report different than the name of the report!!!!! It created a names of Child52 and 53. I used format =ReportMainSub.Report.txtQty. Works like a charm.
One down, 1 to go.




Remember when... everything worked and there was a reason for it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top