Baffled?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just can't figure out why this code is not working? When I run the
subreport by itself it works fine. When I run the Main report I get "0" and I
know there is data in txtSumExpAmount on the subReport.

Main Report Textbox Control Name "txtFamTotal" control source is:
=IIf(subExpDetails.Report.HasData,subExpDetails.Report.txtSumExpAmount,0)

subExpDetails (Control name of the subreport) is located on the Main Report
txtSumExpAmount (Control name of the textbox on subExpDetails)

txtSumExpAmount is located in the Footer Section of each Record Group on
subExpDetails.

Baffled!
 
You say that txtSumExpAmount is in a group footer in the subreport. Try
putting it into the Report Footer of the subreport, or perhaps you would
prefer another text box with the same control source in the subreport's
Report Footer.

You can set the Visible property of the subreport's Group Footer section to
no if you wish, but the main report should get the value from there.

The problem is that the group footer resets for each new group, and I
presume you want the total for the whole subreport, not just the total from
the last group of the subreport.
 
Tru said:
I just can't figure out why this code is not working? When I run the
subreport by itself it works fine. When I run the Main report I get "0" and I
know there is data in txtSumExpAmount on the subReport.

Main Report Textbox Control Name "txtFamTotal" control source is:
=IIf(subExpDetails.Report.HasData,subExpDetails.Report.txtSumExpAmount,0)

subExpDetails (Control name of the subreport) is located on the Main Report
txtSumExpAmount (Control name of the textbox on subExpDetails)

txtSumExpAmount is located in the Footer Section of each Record Group on
subExpDetails.


It is not clear what you mean by "is not working"

I would expect the text box, txtFamTotal, to display the sum
of the values in the last group in the subreport.

If you want the grand total for the entire subreport, then
the value must be calculated in the subreport's Report
Footer section.
 
Allan and Marshall I have tried both your suggestions without success and
this is extremely frustrating because I know it is so simple I even tried
referencing the control on the subform and I still don't get a value in my
textbox on my main report. I know the value is there because I run the
subreport by itself and it works perfectly. Anything you two can think of I
greatly appreciate it.
 
Tru said:
Allan and Marshall I have tried both your suggestions without success and
this is extremely frustrating because I know it is so simple I even tried
referencing the control on the subform and I still don't get a value in my
textbox on my main report. I know the value is there because I run the
subreport by itself and it works perfectly.


What we're both saying is that the txtSumExpAmount text box
must be in the subreport's REPORT Footer section, not a
group footer.

You never did say how you are calculating the sum, but I
have assumed that the text box's expression is something
like:
=Sum(ExpAmount)
which will sum over the scope of where it is used. In a
group footer section it will only sum the group, while in
the Report Footer section, it will sum the entire
(sub)report.

In the future, please state what actually happened, not just
a simple "without success".
 
Sorry about that but everything is working fine now the syntax included a
space I could not see. I appreciate the time and effort, Thanx Again!
 
Back
Top