Open a Tabbed Control to a specific page

G

Guest

I have a button that I want to use to open a form that contains a tabbed
control. When I click the button, it should open the form AND set the focus
to a specific tab. I've tried the DoCmd.OpenForm method but I'm not having
any luck opening the specific tab.

I'm sure it's something I've overlooked or have placed something in the
wrong section of the DoCmd parameters. Any help would be greatly appreciated.

Thanks.....
 
G

George Nicholson

- Open the Form that contains the tab as you normally would.
- In the Form_Open event of that form:

Me.MyTab = x

where x is the PageIndex value of the tab/page you want selected. The
PageIndex of the first tab on the left is 0 (and if you move tabs around
they will renumber themselves so that statement remains true). PageIndex
values can be seen via the Properties window in design view.

It is also possible to refer to tabs/pages by name.

Me.MyTab = Me.MyTab.Pages("pagename").PageIndex

One advantage to this approach is that it would be immune to any problems
caused by auto-renumbering of PageIndexes.

HTH,
 
S

Stuart McCall

Patrick said:
I have a button that I want to use to open a form that contains a tabbed
control. When I click the button, it should open the form AND set the
focus
to a specific tab. I've tried the DoCmd.OpenForm method but I'm not
having
any luck opening the specific tab.

I'm sure it's something I've overlooked or have placed something in the
wrong section of the DoCmd parameters. Any help would be greatly
appreciated.

Thanks.....

You need to SetFocus to the first control in the tab order on the required
page. Here's what I'd do: pass the control name through the OpenForm's
OpenArgs parameter, then, in the form's OnLoad event:

Me(OpenArgs).SetFocus
 
G

Guest

You could pass the name of your tabpage in the OpenArgs attribute of the
DoCmd.OpenForm method and use the OnOpen event to check it and set focus to
that tabpage.

Steve
 
G

Guest

Stuart McCall said:
You need to SetFocus to the first control in the tab order on the required
page. Here's what I'd do: pass the control name through the OpenForm's
OpenArgs parameter, then, in the form's OnLoad event:

Me(OpenArgs).SetFocus



All...

Thank You !!!

I knew it was something simple - I just needed to be pushed in the right
direction.

Again, THANK YOU!
 

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