Hide Subreport if no records

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
 
B

bymarce

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top