Hide sub form

  • Thread starter Thread starter ironwood9 via AccessMonster.com
  • Start date 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
 
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)

?
 
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)

?
 
Back
Top