Hide sub form

  • Thread starter ironwood9 via AccessMonster.com
  • Start date
I

ironwood9 via AccessMonster.com

My subform, named sFrmTime, is sourced by the query sQryTime - I want to hide
the sub form if the sub query returns zero, but the following code in the
Current event of my form doesn't work. Any ideas ?

If Nz(DCount("*", "sQqrytime"), 0) > 0 Then

Me.sFrmTime.Visible = False
Else

End If
 
D

Dirk Goldgar

In
ironwood9 via AccessMonster.com said:
My subform, named sFrmTime, is sourced by the query sQryTime - I want
to hide the sub form if the sub query returns zero, but the following
code in the Current event of my form doesn't work. Any ideas ?

If Nz(DCount("*", "sQqrytime"), 0) > 0 Then

Me.sFrmTime.Visible = False
Else

End If

Is that really the code you're using? It would seem to be hiding the
subform if the query does return records, not the other way around.
Have you tried this:

Me.sFrmTime.Visible = _
(Me.sFrmTime.Form.Recordset.RecordCount > 0)

?
 
I

ironwood9 via AccessMonster.com

right - I had it backwards - thanks !


Dirk said:
My subform, named sFrmTime, is sourced by the query sQryTime - I want
to hide the sub form if the sub query returns zero, but the following
[quoted text clipped - 6 lines]

Is that really the code you're using? It would seem to be hiding the
subform if the query does return records, not the other way around.
Have you tried this:

Me.sFrmTime.Visible = _
(Me.sFrmTime.Form.Recordset.RecordCount > 0)

?
 

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