A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with getting value from subreport



 
 
Thread Tools Display Modes
  #1  
Old April 7th, 2005, 01:24 AM
external usenet poster
 
Posts: n/a
Default 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  
Old April 7th, 2005, 05:24 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 09:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.