Use Data from SubReports

chile19

Registered User.
Local time
Today, 02:12
Joined
Dec 27, 2004
Messages
14
I have 2 subreport on the main report. On the main report I need to print up the sum of some textboxes from each subreport...... no idea.

Please help!!!
Thanks any way
 
Calculate the sums in each subreport then add them (or whatever) in the main report.

You will need (in each subreports footer) a control that has the controlsource such as =Sum([FieldtoSum])

Then on your main report the controlsource would need to be something like

=Reports![MainReport].[Subreport1].Report![Control1] + Reports![MainReport].[Subreport2].Report![Control2]

where Control1 + 2 are the calculated controls in your subreports
 
Great Help.
Thanks a lot.
:)
 
To avoid possible errors with empty subReports you should use the HasData method ;)
 
Sorry but what is the HasData method, and where can I find some info about it?
 
From Access Help:


You can use the HasData property to determine if a form or report is bound to an empty recordset.

Setting

The HasData property is set by Microsoft Access. The value of this property can be read only while printing or while in Print Preview.

Value Description
–1 The object has data.
0 The object doesn't have data.
1 The object is unbound.


You can get the value of the HasData property by using a macro or Visual Basic.

Remarks

You can use this property to determine whether to hide a subreport that has no data. For example, the following expression hides the subreport control when its report has no data.

Me!SubReportControl.Visible = Me!SubReportControl.Report.HasData :eek:
 
Actually it doesn't need any vba
=IIf([SubReportName].[Report].[HasData],[SubReportName].[Report]![TextBox],0)
 

Users who are viewing this thread

Back
Top Bottom