conditional format tab control pages

W

Walter

I have a form with a tab control which contains several subforms. I would
like to highlight the pages which contain data. I think I'll have to hide
any pages on which the subforms are blank. I know I need to test the
subforms, ie.
For each subform on mainform
If IsNull subform1 then
page0.visible = False
End If
Next subform
How do I reference these from the main form?
 
S

Stuart McCall

Walter said:
I have a form with a tab control which contains several subforms. I would
like to highlight the pages which contain data. I think I'll have to hide
any pages on which the subforms are blank. I know I need to test the
subforms, ie.
For each subform on mainform
If IsNull subform1 then
page0.visible = False
End If
Next subform
How do I reference these from the main form?

Although the subforms are on different pages of a tab control, they are
members of the form's controls collection, so the syntax is:

For Each ctl In Me.Controls
If TypeOf ctl Is Subform Then
If IsNull(ctl.Form!ControlName) Then
Me.TabControlName.Page(n).Visible = False
End If
End If
Next

Untested, but that ought to be somewhere close..
 

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