Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


VBA .enabled property use on Tab Control's "On Change" event


VBA .enabled property use on Tab Control's "On Change" event

Author
Message
Barry
Barry
Forum God
Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)Forum God (2.3K reputation)

Group: Forum Members
Posts: 7, Visits: 27
I have a Tab Control, "TabCt", which includes two Tabs (aka Pages) containing subforms(irrelevent though), "Tab1" and "Tab2".  This is on a main form, "Form1", which includes a text box "txtbox" (names for example only).  I would like to have the text box appear only when "Tab1" is selected/active, but not for "Tab2".  There are limited options in the event properties for tab controls, so I have chosen to run the code (below) based on the 'On Change' property.  Currently, based on the code below, the text box disappears when selecting either tab.  I am reaching out for help in adjusting my code (below) to work correctly.  I am wondering if possibly the code needs to be adjusted so that it is not tied to the 'On Change' tab control property as well, but I do not know how to adjust it so.  I read in Help that the Enabled Property applies to Tab Control groups (therefore I wonder if it cannot apply to individual tabs).Private Sub TabCt_Change()Dim txtbox As TextBoxSet txtbox= [Forms]![Form1]![txtbox]  'because it is on the main formIf Me!Tab2.Enabled Then    txtbox .Visible = False Else    txtbox.Visible = TrueEnd IfEnd Sub


Barry

B&W Pantex
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search