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

Adding value from sub report to main report

Status
Not open for further replies.

carm123

MIS
Jul 30, 2003
1
GB
Dear All,

I am working on Access 2000 and back-end sql2000. I have a main report and sub report. The report works fine when there is value in the sub report. However, when there is no values in the sub report, the report will get #Error in the total value in the report footer.

I want to find a way to get the total when there is no values in the sub report.

I tried the NZ function to no avail. I wrote code using recordset to pass the value returned by the subreport onto the main report: to an unbound field. The idea was to then see if the value is 0 and add the value of the main report to the value passed. The program works but I could not pass the value to the report. I kept getting error 2448. However, I could pass the value to a form - but not to the report (disregarding whether the field is in the detail section etc).

Frustration, as I remember me doing the same in Access97, but I cannot get this working in Access2000 and sql2000 backend.

Can anyone helppppp pleaseeeeeeeeeeee???

Regards,

Carmel (carmelfarrugia@aol.com)

 
Carmel
Take a look at the HasData property.

Here's an example from a report of mine. It has a text box with an IIf structure.

=IIf(([rsubJanuaryToJuneTotals subreport].[Report].[HasData]=0),"There are no Contributions to report from January to June.","")

[HasData] = 0 means the subreport has no data (false)
[HasData] = -1 means the subreport has data (true)

So you can set your [HasData] to 0 or -1 depending on what result you want.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top