Move to tabbed page

S

Scott

I have a program with a number of subforms located under several tabs. On a
form under one of the tabs is a button that runs a subroutine. At the end of
the subroutine I would like the program to go to a form under a different
tab. I know how to use the setfocus method and this seems to work...but the
screen display remains on the original tabbed page. I've tried Me.refresh
after the setfocus but that doesn't seem to change anything. Any suggestions
on how to programmatically move from one tabbed subform to a subform located
under a different tab?
 
G

George Nicholson

You need to set focus to the tab/page as well.

To "move" to the first tab (which has an index # of 0 or is named pgOne) of
a tab control called tabMain:

me.tabMain.Pages(0).SetFocus
me.tabMain.Pages("pgOne").SetFocus

HTH,
 
S

Scott

You may have 'almost' resolved my problem...if you could just tell me how to
confirm the "tabMain" name. My two tabs are called 'Work Orders' and
'PrePaymentAgreement'. I've tried me.[Work Orders].Pages(0).SetFocus but
that didn't work. I also clicked to the right of the two tabs but not in the
form and saw a 'TabCtl64'...but substituting that didn't work either. I keep
getting a 'Method or data member not found' error. Your thoughts?
 
G

George Nicholson

Let's get the terminology right, cause I think we are confusing each other.
A single tab control consists of multiple pages, aka tabs.
From what you've described, I'm guessing that you only have one tab control
and that it is named TabCtl64. On that tab control you have 2 pages named
Work Orders and PrePayment Agreement. (And I do mean that those are the
values that are assigned to the Name property of that page, not what is
assigned to the Caption property. These can be different values, but you
need to use the Name value.)

Assuming Work Orders has a Page Index of 0, if you want to give it focus:

Me.TabCtl64.Pages(0).SetFocus
or
Me.TabCtl64.Pages("Work Orders ").SetFocus
(Me = the form on which the tab control resides).

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Scott said:
You may have 'almost' resolved my problem...if you could just tell me how
to
confirm the "tabMain" name. My two tabs are called 'Work Orders' and
'PrePaymentAgreement'. I've tried me.[Work Orders].Pages(0).SetFocus but
that didn't work. I also clicked to the right of the two tabs but not in
the
form and saw a 'TabCtl64'...but substituting that didn't work either. I
keep
getting a 'Method or data member not found' error. Your thoughts?
--
SHB


George Nicholson said:
You need to set focus to the tab/page as well.

To "move" to the first tab (which has an index # of 0 or is named pgOne)
of
a tab control called tabMain:

me.tabMain.Pages(0).SetFocus
me.tabMain.Pages("pgOne").SetFocus

HTH,
 
S

Scott

George, thanks for your patience on this one. I made the changes as
suggested and still no luck. I then decided to create a new mini-database
just to test this out. In that database the tab control (TabCtl4) has two
pages/tabs: Page5 and Page6. On a command button in the subform located on
Page6, I tried both
Me.TabCtl4.Pages(0).SetFocus and
Me.TabCtl4.Pages(Page5).SetFocus
and neither approach took me to the alternative page/tab. I trust your
guidance is good and that I'm doing something wrong here...

After typing 'Me.' there's a list that appears but nowhere in that list is
there a 'TabCtl4' (or Page5 or Page6)...should there be? When I try to run
the program I get a 'Method or Data Member Not found' (the TabCtl4 portion of
the coding is highlighted).

Any further words from the wise that might tell me where I'm going wrong?
Thx in advance.
--
SHB


George Nicholson said:
Let's get the terminology right, cause I think we are confusing each other.
A single tab control consists of multiple pages, aka tabs.
From what you've described, I'm guessing that you only have one tab control
and that it is named TabCtl64. On that tab control you have 2 pages named
Work Orders and PrePayment Agreement. (And I do mean that those are the
values that are assigned to the Name property of that page, not what is
assigned to the Caption property. These can be different values, but you
need to use the Name value.)

Assuming Work Orders has a Page Index of 0, if you want to give it focus:

Me.TabCtl64.Pages(0).SetFocus
or
Me.TabCtl64.Pages("Work Orders ").SetFocus
(Me = the form on which the tab control resides).

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Scott said:
You may have 'almost' resolved my problem...if you could just tell me how
to
confirm the "tabMain" name. My two tabs are called 'Work Orders' and
'PrePaymentAgreement'. I've tried me.[Work Orders].Pages(0).SetFocus but
that didn't work. I also clicked to the right of the two tabs but not in
the
form and saw a 'TabCtl64'...but substituting that didn't work either. I
keep
getting a 'Method or data member not found' error. Your thoughts?
--
SHB


George Nicholson said:
You need to set focus to the tab/page as well.

To "move" to the first tab (which has an index # of 0 or is named pgOne)
of
a tab control called tabMain:

me.tabMain.Pages(0).SetFocus
me.tabMain.Pages("pgOne").SetFocus

HTH,
--
George Nicholson

Remove 'Junk' from return address.


I have a program with a number of subforms located under several tabs.
On
a
form under one of the tabs is a button that runs a subroutine. At the
end
of
the subroutine I would like the program to go to a form under a
different
tab. I know how to use the setfocus method and this seems to
work...but
the
screen display remains on the original tabbed page. I've tried
Me.refresh
after the setfocus but that doesn't seem to change anything. Any
suggestions
on how to programmatically move from one tabbed subform to a subform
located
under a different tab?
 
G

George Nicholson

On a command button in the subform located on
Page6, I tried both...


From a subform? Sorry, I missed that. You said it but I ignored it. My bad.

Me.Parent.TabCtl4.Pages("Page5").SetFocus
Should do it. (Note the quotes when using a string value as an argument).

Where
?Me.Parent.Name
in the Immediate window should return the name of the form where TabCtl4
(and your subform control, for that matter) reside.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Scott said:
George, thanks for your patience on this one. I made the changes as
suggested and still no luck. I then decided to create a new mini-database
just to test this out. In that database the tab control (TabCtl4) has two
pages/tabs: Page5 and Page6. On a command button in the subform located
on
Page6, I tried both
Me.TabCtl4.Pages(0).SetFocus and
Me.TabCtl4.Pages(Page5).SetFocus
and neither approach took me to the alternative page/tab. I trust your
guidance is good and that I'm doing something wrong here...

After typing 'Me.' there's a list that appears but nowhere in that list is
there a 'TabCtl4' (or Page5 or Page6)...should there be? When I try to
run
the program I get a 'Method or Data Member Not found' (the TabCtl4 portion
of
the coding is highlighted).

Any further words from the wise that might tell me where I'm going wrong?
Thx in advance.
--
SHB


George Nicholson said:
Let's get the terminology right, cause I think we are confusing each
other.
A single tab control consists of multiple pages, aka tabs.
From what you've described, I'm guessing that you only have one tab
control
and that it is named TabCtl64. On that tab control you have 2 pages named
Work Orders and PrePayment Agreement. (And I do mean that those are the
values that are assigned to the Name property of that page, not what is
assigned to the Caption property. These can be different values, but you
need to use the Name value.)

Assuming Work Orders has a Page Index of 0, if you want to give it focus:

Me.TabCtl64.Pages(0).SetFocus
or
Me.TabCtl64.Pages("Work Orders ").SetFocus
(Me = the form on which the tab control resides).

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Scott said:
You may have 'almost' resolved my problem...if you could just tell me
how
to
confirm the "tabMain" name. My two tabs are called 'Work Orders' and
'PrePaymentAgreement'. I've tried me.[Work Orders].Pages(0).SetFocus
but
that didn't work. I also clicked to the right of the two tabs but not
in
the
form and saw a 'TabCtl64'...but substituting that didn't work either.
I
keep
getting a 'Method or data member not found' error. Your thoughts?
--
SHB


:

You need to set focus to the tab/page as well.

To "move" to the first tab (which has an index # of 0 or is named
pgOne)
of
a tab control called tabMain:

me.tabMain.Pages(0).SetFocus
me.tabMain.Pages("pgOne").SetFocus

HTH,
--
George Nicholson

Remove 'Junk' from return address.


I have a program with a number of subforms located under several
tabs.
On
a
form under one of the tabs is a button that runs a subroutine. At
the
end
of
the subroutine I would like the program to go to a form under a
different
tab. I know how to use the setfocus method and this seems to
work...but
the
screen display remains on the original tabbed page. I've tried
Me.refresh
after the setfocus but that doesn't seem to change anything. Any
suggestions
on how to programmatically move from one tabbed subform to a subform
located
under a different tab?
 
S

Scott

Now "that" worked! You are officially my hero today. Many, many thanks.
--
SHB


George Nicholson said:
On a command button in the subform located on
Page6, I tried both...


From a subform? Sorry, I missed that. You said it but I ignored it. My bad.

Me.Parent.TabCtl4.Pages("Page5").SetFocus
Should do it. (Note the quotes when using a string value as an argument).

Where
?Me.Parent.Name
in the Immediate window should return the name of the form where TabCtl4
(and your subform control, for that matter) reside.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Scott said:
George, thanks for your patience on this one. I made the changes as
suggested and still no luck. I then decided to create a new mini-database
just to test this out. In that database the tab control (TabCtl4) has two
pages/tabs: Page5 and Page6. On a command button in the subform located
on
Page6, I tried both
Me.TabCtl4.Pages(0).SetFocus and
Me.TabCtl4.Pages(Page5).SetFocus
and neither approach took me to the alternative page/tab. I trust your
guidance is good and that I'm doing something wrong here...

After typing 'Me.' there's a list that appears but nowhere in that list is
there a 'TabCtl4' (or Page5 or Page6)...should there be? When I try to
run
the program I get a 'Method or Data Member Not found' (the TabCtl4 portion
of
the coding is highlighted).

Any further words from the wise that might tell me where I'm going wrong?
Thx in advance.
--
SHB


George Nicholson said:
Let's get the terminology right, cause I think we are confusing each
other.
A single tab control consists of multiple pages, aka tabs.
From what you've described, I'm guessing that you only have one tab
control
and that it is named TabCtl64. On that tab control you have 2 pages named
Work Orders and PrePayment Agreement. (And I do mean that those are the
values that are assigned to the Name property of that page, not what is
assigned to the Caption property. These can be different values, but you
need to use the Name value.)

Assuming Work Orders has a Page Index of 0, if you want to give it focus:

Me.TabCtl64.Pages(0).SetFocus
or
Me.TabCtl64.Pages("Work Orders ").SetFocus
(Me = the form on which the tab control resides).

HTH,
--
George Nicholson

Remove 'Junk' from return address.


You may have 'almost' resolved my problem...if you could just tell me
how
to
confirm the "tabMain" name. My two tabs are called 'Work Orders' and
'PrePaymentAgreement'. I've tried me.[Work Orders].Pages(0).SetFocus
but
that didn't work. I also clicked to the right of the two tabs but not
in
the
form and saw a 'TabCtl64'...but substituting that didn't work either.
I
keep
getting a 'Method or data member not found' error. Your thoughts?
--
SHB


:

You need to set focus to the tab/page as well.

To "move" to the first tab (which has an index # of 0 or is named
pgOne)
of
a tab control called tabMain:

me.tabMain.Pages(0).SetFocus
me.tabMain.Pages("pgOne").SetFocus

HTH,
--
George Nicholson

Remove 'Junk' from return address.


I have a program with a number of subforms located under several
tabs.
On
a
form under one of the tabs is a button that runs a subroutine. At
the
end
of
the subroutine I would like the program to go to a form under a
different
tab. I know how to use the setfocus method and this seems to
work...but
the
screen display remains on the original tabbed page. I've tried
Me.refresh
after the setfocus but that doesn't seem to change anything. Any
suggestions
on how to programmatically move from one tabbed subform to a subform
located
under a different tab?
 

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