I have a report I'm working on, with multiple subreports. Each subreport totals up various categories, working from separate queries, and the total report basically just strings the subreports together. It's possible that some of the subreports' queries will return no data, but in that case, I want the report to show zeroes for those items.
Taking one of the subreports as my test bed here, I have six items in the subreport, each of which I have (so far) filled in like so:
=Abs(Sum(([Field1]="foo") And [Field2]="bar"))
This works just fine, giving me appropriate totals of any of the permissible combinations of what I'm looking for in Field1 and Field2, including zeroes where no records with those combinations are returned by the query as long as any records at all are returned. However, if the query returns no records, all of those fields just show "#ERROR" in the report, which is less than wonderful.
On the other hand, if no records are returned, I don't need to do much counting as I know that all of the fields should be 0. My latest attempt to do this is:
Expand|Select|Wrap|Line Numbers
- Private Sub Report_NoData(Cancel As Integer)
- Me.Text74.SetFocus
- Me.Text74.Text = "0"
- Me.Text76.SetFocus
- Me.Text76.Text = "0"
- Me.Text78.SetFocus
- Me.Text78.Text = "0"
- Me.Text81.SetFocus
- Me.Text81.Text = "0"
- Me.Text83.SetFocus
- Me.Text83.Text = "0"
- Me.Text85.SetFocus
- Me.Text85.Text = "0"
- End Sub
Expand|Select|Wrap|Line Numbers
- Microsoft Office Access doesn't allow you to use this method in the current view.
So where am I going wrong? Anybody have any ideas for a better approach?
Thanks,
Paul