Hide Tab if Subform contains no records

R

Renee Moffett

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

Thank you.
 
C

Chadlon

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
 

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