Hide Tab if Subform contains no records

  • Thread starter Thread starter Renee Moffett
  • Start date Start date
R

Renee Moffett

Does anyone no how to do this? I'd appreciate some advice. I don't know
where to begin.

Thank you.
 
Assuming the subform recordset is linked to the main form recordset, in the
OnCurrent event of the main form (the one that has the Tabbed Control) check
for the population of the subform and use that to arrange the visibility of
the page of the tabbed control that contains the subform.

So, if the tabbed control page is named pagContainsSubform and if the
subform control is named sfSubform (note this is the control name and _not_
the form name), the main form Current event could contain code such as:

Private Sub Form_Current()
' ... other code
Me.pagContainsSubform.Visible =
(Me.sfSubForm.Form.RecordsetClone.Recordcount<>0)
' ... other code
End Sub
 
Back
Top