I have a report with some problems... This is a report with 4 sub reports. On the main report are some totals calculated from the sub reports. All works well when there are figures in the sub report, but errors when the fields are null.
So I changed this =rptSubOverhead.Report!txtSumOverheadCost*12
to this
=nz(rptSubOverhead.Report!txtSumOverheadCost,0)*12
But still error in the total field
Any ideas as to why??
Thanks
Curtis
llkhoutx
12-31-2005, 08:28 PM
I think that your referencing the subreport incorrectly. The correct syntax is:
Resports!MainReportName!subReportname.Name!Control Name
According, your calculation should be:
NZ(Reports!MainReportName!rptSubOverhead.Report!tx tSumOverheadCost)*12
where MainReportName is your report name. You are correctly converting a null.
OK..tried it
=NZ(Reports!rptCurrentBid!rptSubOverhead.Report!tx tSumOverheadCost)*12
Still getting error.
rptCurrentBid is the main report ans rptSubOverhead is the sub report.
llkhoutx
12-31-2005, 09:56 PM
Note that you carried forward my typo:
=NZ(Reports!rptCurrentBid!rptSubOverhead.Report!tx tSumOverheadCost)*12
Shouldn't it be:
=NZ(Reports!rptCurrentBid!rptSubOverhead.Report!tx tSumOverheadCost)*12
You don't say what error. I presume that it's #Error, oi something like that.
That indicates that your report name, subreportname, or field name is misspelled, or that txtSumOverHeadcCost is not calculating correctly. Is it correct on the referenced subform?
Sometimes Access just interprets code wrong, even when it appears to be right. Merely retyping the line, being sure objects are spelled correctly, cures the problem. Otherwise, your reference is incorrect.
Yes, I saw the typo..... Still didn't work. The error is #Error
I used the expression builder to avoid any typos... When there are figures in the report fields all works fine. Only dealing with the nulls that is the problem. I'll attach it...easier to see then explain. Form is "frmContactsBid" then preview report.... so Record #1 Bid ID 7 is fine... record #2 Bid ID #8 has errors.
llkhoutx
01-01-2006, 10:37 AM
Worked fine for me. Records 2 and 6 didn't display rptSubOverhead data. All other records displayed data in that subreport.
They display correctly in the FORM, but not in the REPORT
Rickster57
01-01-2006, 11:52 AM
I believe your errors are being caused by the fact that there is no data.This is different than having actual Null Values. I suggest you look into using the HasData property in your subreport. This way if data does not exist it will set the value to zero.
Hope this helps.
llkhoutx
01-01-2006, 12:17 PM
The (preview) report and subreports displayed without errors for me. Records 2 and 6 didn't display rptSubOverhead data.
If the preview if different from the report; then they're not the same.
Rickster57
01-01-2006, 12:23 PM
Strange indeed!! I also received #Error for id=8
Nice Call Rickster!
=IIf(rptSubOverhead.Report.HasData,rptSubOverhead. Report!txtSumOverheadCost*12,0)
This did the trick using the "HasData" in an IIF
Thank you all for your input!