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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport sum in main returning data from wrong record

Status
Not open for further replies.

SunGodly

Programmer
Jul 16, 2002
40
US
Hello, everyone. I have a text box in my main report which acquires its value from a sum in the subreport footer. However, the value it returns is for the next record/page of the main report instead of the current record. Can anyone please assist?

Thanks!
 
What is the control source of the text box?
What are the master child fields for the subreport?
Is the subreport in the detail section or which section is it in?
If the sub report is not in the detail section, what if any grouping do you have?
 
The purpose of the report is to produce telephone service invoices for residents of a retirement home. The subreport details the resident's long distance calls and provides a sum of the costs of each call. This is the control for the text box in the main report (=numCallCostSum). The master/child fields are the same for both - the resident telephone number (10 digits, text format). The subreport is in the detail section.

In essence, what's happening is that the sum of call costs for the first resident are showing up in the second resident main report, rather than the resident's own total. In the subreport itself, the sum is working properly.

I can get the totals from a nested query within the query that the main report is based on but I thought it would be more efficient (and possibly faster) to use the calculation from the subreport. If you need more information, please let me know - I would very much like to know how to do this without the nested query, if for nothing else other than my peace of mind.

Thanks for your help.
 
Sounds like it should work...
Can you just display the total in the subreport? I'd make the control visible in the subreport to verify that the two values are different.

Does the sub report have any grouping? I'd group by the telephone number and put the sum control (numCallCostSum)in the telephone number footer.

If you still don't have any luck, you could try changing the criteria of your query of the subreport to look at the phone number in the main report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top