Enabled property use - Tab Control "On Change"

Joined
Mar 25, 2009
Messages
13
Reaction score
0
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
 

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