On Click even - Tab COntrol

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to hid a subform when a user clicks the top meny of a tab (the
actual tab desciption. However, this does not work. The onClick even is
only activated when the user mouse down's on the inside of the tab control.

This is pretty useless as I dont want the user to see the current sub form
sitting on top of the new one before the user hits the inside of the control
and the previous form becomes ivisible.

Is there any way I can activate the onClick event when the user selects the
tab description at the top of the tab control???

Please help.
 
stephenson22 said:
I would like to hid a subform when a user clicks the top meny of a tab (the
actual tab desciption. However, this does not work. The onClick even is
only activated when the user mouse down's on the inside of the tab
control.

This is pretty useless as I dont want the user to see the current sub form
sitting on top of the new one before the user hits the inside of the
control
and the previous form becomes ivisible.

Is there any way I can activate the onClick event when the user selects
the
tab description at the top of the tab control???

Please help.

You can use the tab control's Change event. As you have discovered the tab's
on_click is for the most part useless

HTH
SteveC
 
You're correct that clicking on the tab itself doesn't activate the OnClick
event but I was also wondering what you are trying to accomplish.

Are you trying to put a one subform on each of the tabs or are you talking
about layering subforms outside of the tab control?

Regardless, try the following bit of code; monitor the index of the
currently selected Page object on the Tab control. I have a simple form with
a tab control (TabCtl0) and a subform on it (subTest). Depending on which of
the two tabs is selected, it hides or unhides the subform.

HTH.

Private Sub TabCtl0_Change()
If TabCtl0.Value = 0 Then
subTest.Visible = False
ElseIf TabCtl0.Value = 1 Then
subTest.Visible = True
End If
End Sub
 
Thank you for the help.

I have seen a solution like this before, but I dont know where to place the
code?

DO I just create a new module in VBA? or do I place the code in the VBA
section of the tba control???
 
Just select the tab control, view its properties, click on the Events tab and
start a new piece of code by choosing the Code Builder option.
 
Back
Top