Dear All,
I have a bound main form named frmInTransmittal, it has a tab control (TabCtl6) with 5 pages (Pages0 to 4).
Each page has their own subforms bound to its respective tables. Each 5 subforms have its own field called "InTrans"
that is linked to the mainform's text box called "InTransNum".
What I would like to happen here is that if I'm on the current record or upon opening the mainform, I want the page to be invisible as long as its subform have zero recordcount. If all of them have records, then naturally
I want all 5 pages to be visible.
Here's the code in my mainform, and it gives me an error when I open it:
Run-time error '2165': You can't hide a control that has the focus.
Your help is highly appreciated.
qwerty70
I have a bound main form named frmInTransmittal, it has a tab control (TabCtl6) with 5 pages (Pages0 to 4).
Each page has their own subforms bound to its respective tables. Each 5 subforms have its own field called "InTrans"
that is linked to the mainform's text box called "InTransNum".
What I would like to happen here is that if I'm on the current record or upon opening the mainform, I want the page to be invisible as long as its subform have zero recordcount. If all of them have records, then naturally
I want all 5 pages to be visible.
Here's the code in my mainform, and it gives me an error when I open it:
Run-time error '2165': You can't hide a control that has the focus.
Code:
Private Sub Form_Current()
Me.TabCtl6.Pages(0).Visible = (Me.[Calculation Sheet].Form.Recordset.RecordCount > 0)
Me.TabCtl6.Pages(1).Visible = (Me.[Contractor Drawing Submittal].Form.Recordset.RecordCount > 0)
Me.TabCtl6.Pages(2).Visible = (Me.[Contract].Form.Recordset.RecordCount > 0)
Me.TabCtl6.Pages(3).Visible = (Me.[Equipment Data Sheet].Form.Recordset.RecordCount > 0)
Me.TabCtl6.Pages(4).Visible = (Me.[Engineering Drawing].Form.Recordset.RecordCount > 0)
End Sub
Your help is highly appreciated.
qwerty70