Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Tab based on value from another Tab?

Status
Not open for further replies.
Nov 22, 2007
38
GB
Hi

I've been through the site and tried all the suggestions but must be missing something as can't seem to get it to work.

I need a tab to be disabled if a control on anther tab is false.

I have the following code:

Code:
Private Sub Complete_AfterUpdate()
     If Me.Complete = True Then
      Me![Debtor Details].Visible = True
   Else
      Me![Debtor Details].Visible = False
   End If
End Sub

The tab control is called TabCtl0
The tab is number 9 and caleld Debtor Details
The Subform on the tab is called Frm_Debtors

Going slightly mad now i think...

Ralph
 
Is it possible that Debtor Details is the Caption rather than the Name?
 
The control you seem to reference is on the subform. If that is the case, the computer_afterupdate needs to reference the parent form before it can make any changes.

So your code modified...

If Me.Complete = True Then
Me.Parent.[Debtor Details].Visible = True
Else
Me.Parent.Debtor Details].Visible = False
End If

Does this help?

Gary
gwinn7
 
If I understand you have a page on a tab control called "Debtor Details"

I would then build a procedure that you can call from different events because you may want to call this from the forms on current event once you have data in it.

Public Sub hideDebtorDetails()
If Me.Complete = True Then
Me.TabCtl0.Pages("Debtor Details").Visible = False
Else
Me.TabCtl0.Pages("Debtor Details").Visible = True
End If
End Sub
 
Hi

Thank you Gary that solved the issue

THanks to all for the input

Ralph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top