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!

Control Tab Problem

Status
Not open for further replies.

mike1975

IS-IT--Management
Jun 26, 2001
38
GB
I have a Control Tab on a form that has three pages on it. On my first page I have a check box that is called finance, I also have a corresponding page on the tab control called Finance. Basically I want to make the finance page become enabled or disabled depending on whether or not the finance check box has been checked.

Any help would be greatly appreciated.

MIKE
 
Try this and see if it will work for you.

Code:
Private Sub Finance_Click()  ' this is the check box

If Finance.Value = True Then ' if checked then
    Me.Page3.Enabled = True  ' enable the tab
    Me.Page3.Visible = True  ' make the tab visible
Else                         ' if not checked then
    Me.Page3.Enabled = False ' disable the tab
    Me.Page3.Visible = False ' make it invisible
End If

End Sub

I have both enabled and made the tab visible upon clicking the check box. It isn't the tab itself the gets disabled but the objects within it. (textboxes, labels, etc.)

HTH

Ken ::)
 
The tabs are actually in the tab controls pages collection. You can set the visible property of a page in the collection when the value of the checkbox changes:

Private Sub chkBox_Click()
tabControl.Pages(2).Visible = chkBox.Value
End Sub

I think you can reference the page by its name, but I'm not sure:
tabControl.Pages("Finance").Visible = chkBox.Value

Anyway, hope this helps.
-Chris Didion
Matrix Automation, MCP
 
Thanks for the tips guys - I have it working now! Stand by for more questions no doubt!!!
 
Hang on - I spoke too soon!! I need the page to remain deactivated for each record! At the moment when I check the box it activates all the records regardless of whether the check box is checked on that record or not!

MIKE
 
I'm not sure which event triggers as you scroll through a recordset, it might be After_Update...anyways, find out the event that fires when the value changes as you scroll through your recordset and call your existing code from there.

HTH
Ken

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top