I have a report with a subreport. On the subreport is an invisible =Sum([Myfield]) control. Then on the main form, another control shows whatever is in that subreport control.
The subreport is driven by a query. My problem is that when the query returns nothing, the subreport doesn't display, and my control on the main form shows 'Error'.
I got around this by using a Dlookup() on a new query which returns the total that I need, for my control on the main report. So no more 'Error'. However, when there are no records, Dlookup() doesn't return '0', but nothing. I tried NZ(Dlookup()) but still nothing. I need to have a '0' in the control on the main report when there are no records, as that is part of a total. How do I get '0' when there are no records returned by the query?
Robert
The subreport is driven by a query. My problem is that when the query returns nothing, the subreport doesn't display, and my control on the main form shows 'Error'.
I got around this by using a Dlookup() on a new query which returns the total that I need, for my control on the main report. So no more 'Error'. However, when there are no records, Dlookup() doesn't return '0', but nothing. I tried NZ(Dlookup()) but still nothing. I need to have a '0' in the control on the main report when there are no records, as that is part of a total. How do I get '0' when there are no records returned by the query?
Robert