445,705 Members | 1,795 Online
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

# Access report totals

 P: n/a Hello- I just managed to get the total from my subreport to sum with my main report total. I am able to get the correct display if I do not have any total in my subreport. BUT, what if I don't have a total in my main report? Below is the control source for my main report's total textbox. =Sum([ExtPrice])+IIf(srptSOPItems.Report.HasData,srptSOPItems.Rep ort.SOPTotal,0) Again, if there is only a total from the sub, and not the main report, how would you rewrite this equation to reflect that? Thanks- Scott Nov 13 '05 #1
6 Replies

 P: n/a Use Nz() to specify zero for null: =Nz(Sum([ExtPrice]),0) + IIf(srptSOPItems.Report.HasData,Nz(srptSOPItems.Re port.SOPTotal,0),0) -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Scott" wrote in message news:11**********************@f14g2000cwb.googlegr oups.com... I just managed to get the total from my subreport to sum with my main report total. I am able to get the correct display if I do not have any total in my subreport. BUT, what if I don't have a total in my main report? Below is the control source for my main report's total textbox. =Sum([ExtPrice])+IIf(srptSOPItems.Report.HasData,srptSOPItems.Rep ort.SOPTotal,0) Again, if there is only a total from the sub, and not the main report, how would you rewrite this equation to reflect that? Nov 13 '05 #2

 P: n/a Allen Browne wrote: Use Nz() to specify zero for null: =Nz(Sum([ExtPrice]),0) + IIf(srptSOPItems.Report.HasData,Nz(srptSOPItems.Re port.SOPTotal,0),0) -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Scott" wrote in message news:11**********************@f14g2000cwb.googlegr oups.com... I just managed to get the total from my subreport to sum with my main report total. I am able to get the correct display if I do not have any total in my subreport. BUT, what if I don't have a total in my main report? Below is the control source for my main report's total textbox. =Sum([ExtPrice])+IIf(srptSOPItems.Report.HasData,srptSOPItems.Rep ort.SOPTotal,0) Again, if there is only a total from the sub, and not the main report, how would you rewrite this equation to reflect that? This just returned #ERROR......Any ideas? Nov 13 '05 #3

 P: n/a If there are no records in the main report, you will need to test its HasData property as well. If there are records, split the expression into 2 text boxes until you get it working correctly. Once you have it solved, you can put it back together again. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Scott" wrote in message news:11**********************@f14g2000cwb.googlegr oups.com... Allen Browne wrote: Use Nz() to specify zero for null: =Nz(Sum([ExtPrice]),0) + IIf(srptSOPItems.Report.HasData,Nz(srptSOPItems.Re port.SOPTotal,0),0) "Scott" wrote in message news:11**********************@f14g2000cwb.googlegr oups.com... > > I just managed to get the total from my subreport to sum with my main > report total. I am able to get the correct display if I do not have any > total in my subreport. BUT, what if I don't have a total in my main > report? Below is the control source for my main report's total textbox. > > =Sum([ExtPrice])+IIf(srptSOPItems.Report.HasData,srptSOPItems.Rep ort.SOPTotal,0) > > Again, if there is only a total from the sub, and not the main report, > how would you rewrite this equation to reflect that? This just returned #ERROR......Any ideas? Nov 13 '05 #4

 P: n/a Allen- Thanks for the help on this. It would be when the main report has no records, but the sub report does. How would you test the HasData property? *** Sent via Developersdex http://www.developersdex.com *** Nov 13 '05 #5

 P: n/a =IIf([Report].[HasData], Nz(Sum([ExtPrice]),0), 0) + IIf(srptSOPItems.Report.HasData,Nz(srptSOPItems.Re port.SOPTotal,0),0) -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Scott Sabo" wrote in message news:bV**************@news.uswest.net... Allen- Thanks for the help on this. It would be when the main report has no records, but the sub report does. How would you test the HasData property? Nov 13 '05 #6

 P: n/a Allen- This worked, thanks so much for the help! I have a much greater understanding of this now. Scott Nov 13 '05 #7

### This discussion thread is closed

Replies have been disabled for this discussion.