Hide Subreport if no records

  • Thread starter Thread starter bymarce
  • Start date Start date
B

bymarce

I have a sub report to display conditions under which a experiment was run.
Not all experiments have conditions. How can I hide the subreport when it
has no records? I've tried the following code but it's doesn't seem to be
executing. I've also put it in the On Current event of the form. Should I be
putting it somewhere else? Or is there a simpler way to do this? Thanks.
Marcie

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim RcdCnt As Long
RcdCnt = DCount("Condition", "Conditions")
Debug.Print RcdCnt
If Not RcdCnt > 0 Then
Me.subrptConditions.Visible = False
End If
End Sub
 
I forgot to mention that the source of the text box on the subreport is
=[Condition] & "=" & [Units] so when there are no records just the = shows.
 
Back
Top