capturing and setting the page of a control tab

  • Thread starter Thread starter Paul Ponzelli
  • Start date Start date
P

Paul Ponzelli

What VBA expression can I use to get (and also set) the page of a tab
control?

When I open a form that has a tab control, I would like the tab control to
display the last page that was displayed before the form was last closed. I
know how to store a value in a configuration or system table, but what I
can't figure out is how to obtain that value from the form. I've tried
various combinations of the Page, Pages and PageIndex properties, but I
can't get it to work.

If the form is named myForm and the tab control is named ctlMyTabControl,
how can I write an expression that will return the current page displayed in
the form's tab control?

Thanks in advance,

Paul
 
Hi Paul,

The tab control's value property contains the currently displayed page of
the control. So, to save it, simply save:
Me.ctlMyTabControl.Value

To change the page via code, use a statement such as:
Me.ctlMyTabControl.Value = 2
This example would cause the third page of the tab control to gain focus,
since the Value is a zero-based index.

HTH,

Rob
 
Your welcome. Maybe it will come in handy somewhere along the way.

Shane
 
Back
Top