Hiding a Subform

By Kath Pelletti

 

Use the following code in the main form’s Current event to hide a subform if there are no records present:

Private Sub Form_Current()
    With Me![SubformName].Form

.Visible = (.RecordsetClone.RecordCount > 0)
    End With
End Sub