If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Help with getting value from subreport
I have a report "rptHousing2" with a
subform "rptHousingSub2". On the subform I have a control that counts the number of records in the subreport. The name of this control is CountRooms. Now I am trying to sum the values from this control on the main report. I have a control on the main report: =Sum([rptHousingSub2].Reports!CountRooms) which I built with the code builder results in asking me for a parameter value when I try to print the report. What am I doing wrong. BTW, "rptHousingSub2" is the name of the subreport control as well as the name of the subreport. Thanks, Sandra Grawunder |
#2
|
|||
|
|||
Presumably you already have the count in the CountRooms control on the
subreport. The =Sum() part is not going to work, so we will drop that. You can use a Running Sum property of the text box on the main report if that is what you need to achieve. Use ".Report" (without the S) to refer to the report in the subreport control. Try: =[rptHousingSub2].[Report]![CountRooms] That should work until you hit a record in the main report that has no matches in the subreport. To get around that, you need to test the HasData property of the report in the subreport control. Try: =IIf([rptHousingSub2].[Report].[HasData], Nz([rptHousingSub2].[Report]![CountRooms],0), 0) -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. wrote in message ... I have a report "rptHousing2" with a subform "rptHousingSub2". On the subform I have a control that counts the number of records in the subreport. The name of this control is CountRooms. Now I am trying to sum the values from this control on the main report. I have a control on the main report: =Sum([rptHousingSub2].Reports!CountRooms) which I built with the code builder results in asking me for a parameter value when I try to print the report. What am I doing wrong. BTW, "rptHousingSub2" is the name of the subreport control as well as the name of the subreport. Thanks, Sandra Grawunder |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
repeating records in a subreport | Paul James | Setting Up & Running Reports | 2 | February 2nd, 2005 06:11 PM |
Requery Subreport For Each Group | Melissa | New Users | 0 | September 30th, 2004 07:26 AM |
SubReport No Data printing problem | Tony_VBACoder | Setting Up & Running Reports | 1 | August 9th, 2004 10:10 PM |
Problems totalling subreport data on main report (A-2002) | Marshall Barton | Setting Up & Running Reports | 0 | June 23rd, 2004 08:01 PM |