I'm having trouble with a report that contains 5 subreports. I'll start off by showing you the fields involved, then explain the issue.
In the report footer of each of the 5 subreports, there is a text box called txtSectionXAvg (the X will be 1 - 5, depending on which subreport it's in), and the control source is: =Avg([AvgOfQuestion_Response]). AvgOfQuestion_Response is calculated by a query. There is one query for each subreport.
In the report footer of the main report, there are 5 text boxes called txtSectionXAvg, and the control source for each is =srptSectionX.Report![txtSectionXAvg]. All five of these text boxes are not visible.
Also in the report footer of the main report is another text box called txtReportAvg, and the control source is =([txtSect1Avg]+[txtSect2Avg]+[txtSect3Avg]+[txtSect4Avg]+[txtSect5Avg])/5.
This is pretty crude, I suppose, but it's the only way I could figure out how to get an average of all of the subreports in the footer of the main report. You may already see what my problem is (besides bad code!). For some of the reports generated, there is no data at all for subreport 4. Hence, the txtSection4Avg text box contains #Error. This, in turn, causes the same message to appear in the txtReportAvg text box.
So here's my question: is there a way to calculate that average if there is no data for subreport 4? I've searched through the Access forums for a similar question, and came up empty. The Access help files aren't much better. Oh yeah... I'm using Access 2002 SP2.
Any help you can give me would be greatly appreciated!
Thanks,
Mike
![[morning] [morning] [morning]](/data/assets/smilies/morning.gif)
In the report footer of each of the 5 subreports, there is a text box called txtSectionXAvg (the X will be 1 - 5, depending on which subreport it's in), and the control source is: =Avg([AvgOfQuestion_Response]). AvgOfQuestion_Response is calculated by a query. There is one query for each subreport.
In the report footer of the main report, there are 5 text boxes called txtSectionXAvg, and the control source for each is =srptSectionX.Report![txtSectionXAvg]. All five of these text boxes are not visible.
Also in the report footer of the main report is another text box called txtReportAvg, and the control source is =([txtSect1Avg]+[txtSect2Avg]+[txtSect3Avg]+[txtSect4Avg]+[txtSect5Avg])/5.
This is pretty crude, I suppose, but it's the only way I could figure out how to get an average of all of the subreports in the footer of the main report. You may already see what my problem is (besides bad code!). For some of the reports generated, there is no data at all for subreport 4. Hence, the txtSection4Avg text box contains #Error. This, in turn, causes the same message to appear in the txtReportAvg text box.
So here's my question: is there a way to calculate that average if there is no data for subreport 4? I've searched through the Access forums for a similar question, and came up empty. The Access help files aren't much better. Oh yeah... I'm using Access 2002 SP2.
Any help you can give me would be greatly appreciated!
Thanks,
Mike
![[morning] [morning] [morning]](/data/assets/smilies/morning.gif)