DerekMcDonald
Technical User
Hi! I have a report with 4 unbound subreports in it. I'd like to be able to loop through the subreports to determine if they contain no data, and then display a label if they're all empty. Trouble is, while I can do this with forms, I can't figure out the code for reports. Here's kind of what I'm trying to do, with (?) in the area I'm stuck on:
Private Sub Report_Open(Cancel As Integer)
Dim rpt As Control
Dim intCounter As Integer
intCounter = 0
For Each rpt in me. ????? ("Controls" doesn't work...)
If rpt.Report.RecordsetClone.RecordCount > 0 Then
intCounter = intCounter + 1
End If
Next rpt
If intCounter = 0 Then
Me.lblCongrats.Visible = True
End If
End sub
Each subreport is bound to a separate query. Perhaps I'm approaching this all wrong? Any help would be appreciated!
Private Sub Report_Open(Cancel As Integer)
Dim rpt As Control
Dim intCounter As Integer
intCounter = 0
For Each rpt in me. ????? ("Controls" doesn't work...)
If rpt.Report.RecordsetClone.RecordCount > 0 Then
intCounter = intCounter + 1
End If
Next rpt
If intCounter = 0 Then
Me.lblCongrats.Visible = True
End If
End sub
Each subreport is bound to a separate query. Perhaps I'm approaching this all wrong? Any help would be appreciated!