Condition on Tab Pages

emina002

Registered User.
Local time
Today, 23:49
Joined
Jan 19, 2019
Messages
15
I have built a

Main form: TabsControl
Inside the main form was
1st Subform: HeaderRisk (on top)
2nd Tab Controls: TabCt17

On my tab controls, I include 3 pages with 3 subforms embed on it.

Somehow, I want to set a condition if the tab page was selected, it will perform a specific action on that pages only.

Any way to do it? Thanks.
 
check the value property of the tab. when you change the tab page the tabs value changes. I believe it is zero based.
 
So how to know the pages was selected? I need to create a VBA inside and want to use an IF Condition.
 
Any idea on how to construct an "If Condition" to reference if the tab pages has been selected? Thanks.
 
Code:
Select Case Me.MyTabControlName.value
  case 0
    'Do something since the first tab is selected
  case 1
    'do something since the second tab is selected
  ....
   case 10
   ....
  end select
 
You most likely want to put this on the tab control on change event.
 
MajP has given you the syntax. Rather than using If...Then, it's better to use the Select Case construct...like this:

Code:
Private Sub YourTabControlName_Change()
 
 Select Case YourTabControlName

  Case 0 'First Page is selected
    
    'Code for first page goes here
    
  Case 1 'Second Page is selected

     'Code for second page goes here

  Case 2 'Third Page is selected
  
     'Code for third page goes here

 End Select

End Sub
Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom