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

Miscalculation in Access Subreports 1

Status
Not open for further replies.

techneophyte

Programmer
Jan 7, 2009
5
US
I have a main Access 2003 report containing 6 subreports. On the Main report I have txt boxes that calculate using 1 box from 2 different sub reports.
Example: txtInpatientPMPM divides the amount of inpatient claims(sumOfcInpatientClaims)on subrpt1 by the number of members (iNumOfMembers) on subrpt2.

for the monthly subreports this works perfectly. However on the YTD subreports it doesn't. I've used the wizard to be sure I have the correct boxes in the correct subreports and I've quadruple-checked the names of the subreports, the names and values of the boxes etc. but cannot figure out why the YTD doesn't work.

Has anyone else experienced this problem? Thanks
 
This might be caused by expressions that reference the Source Object property of the subreport control rather than the subreport control name. These two values are generally the same but could be different.

We can't see your reports and properties so you will have to provide more specifics if you can't get this sorted out.

Duane
Hook'D on Access
MS Access MVP
 
Thanks, I'll give a little more info.
I have a subreport "subrptMORCurrent" which has a field showing we paid $2M in inpatient services for the month of Dec. When I divide by the "txtMembership" (2000) from subrpt "subrptMORCurrentMembers" I get the correct answer of 1000.

=[subrptMORCurrent].[Report]![SumOfcInpatientCosts]/[subrptMORCurrentMembs].[Report]![txtMembership]
The above works fine

My next subrpt "subrptMORCurrentYTD" shows we paid $10M in inpatient services for YTD of Jan - Dec. when I divide by the "txtMemberMonths" (9000) from subrpt "subrptMORCurrentYTD" I get the answer $222.22 which is actually $2M/9000

=[subrptMORCurrentYTD].[Report]![txtSumOfcInpatientCostsYTD]/[subrptMORMembsYTD].[Report]![txtMemberMonths]
The above divides $2M by 9000 even though the report is showing $10M

I've tried the code both ways, referencing the Name and then the Source Object.

BTW, subrptMORCurrentYTD uses the same underlying query as subrptMORCurrent except the Filter on the form sums the previous 12 months. Instead of looking at the value on the form could it just be looking at one of the 12 months?

What other properties would be helpful
 
I would try divide the expression into two text boxes so you can see what values are being divided. This should point to error which might be that you are looking at just one month.

You should always use the Name rather than the Source Object. You also mentioned "Filter on the form sums..." and I'm not sure where "form" comes in to play. Do you actually mean a report?

Duane
Hook'D on Access
MS Access MVP
 
Duh...[sound of head banging against wall]...user error. Don't ever get altzheimers! The sub rpt was greatly reduced to fit on the page and I was pulling the value from the detail line instead of the totals line under the "Line of Business" footer. If I had only scrolled down the list I would have seen the totals boxes at the bottom and saved about 4 hours of excruciating head banging fruitless troubleshooting. Thanks for your response and help !!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top