Access - Form Control Button vb to change to a different Tab Page in same Form

Hello All

Ok over the past couple days I've asked a few questions the answer to one of them the Expert suggested Tabbed form.  Haven't used them much if at all.   Anyway, my form will have several, about 5-6 tabs.  On my first tab I have a Form Control button with some vb coding behind it to get some particular info and then I want it to switch the view from the current tab (in this example it's (Page1, Page Index 0)

How do I change the active displayed tab in vb to Pag2, Page Index 1 in the vb code???

I tried
[Forms]![frm_DataReporting]![CONTROL TOTALS FROM WV LVL REPORTING SYSTEM].[Form]![txtCtlAmtIn].SetFocus

Open in new window

wlwebbAsked:
Who is Participating?
 
IrogSintaCommented:
That's why I asked you earlier if the Tab control was on the same form as the the button.  So apparently you have the button in a subform that is inserted in the first page of the Tab control.  Since your Tab control is on the main page, to refer to it, you need to use Parent instead of Me. You could used either of the following:

Parent.TabCtl0.value = 1
Parent.Page2.SetFocus
0
 
IrogSintaCommented:
You can use either of these methods:
Me.NameOfPage.SetFocus
Me.NameOfaControlOnThePage.SetFocus
Me.NameOfTabControl.Value= 1   'this is the index of the page

Open in new window

0
 
wlwebbAuthor Commented:
Ok,
Trying method 3 above......

The Property Sheet shows:
Name = Page2 (no spaces)
Page Index  = 1

So in the coding of a on click event from Page1, Page Index 0 I put

Me.Page2.Value = 1

I get
Compile Error:
Method or data member not found.

????????????
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
wlwebbAuthor Commented:
Tried number 1 also....

Me.page2.SetFocus

Same error??????



JUST FYI
Don't think it matters but..... I have a Caption for each tab......
Page 2's caption is [LVL Control Totals]
0
 
mbizupCommented:
No points here... Ron's got your answer.

"Page2" is the name of the page, not the tab control.  So if you are referring to Page2, you should use Method 1 in his post:

--->>> Me.NameOfPage.SetFocus

Me.Page2.SetFocus


Edit...

Interesting.  I could have sworn there was an hour since wlwebb's last post (otherwise I wouldn't have jumped in).
0
 
IrogSintaCommented:
For number 3, you need to use the name of the Tab control, not the name of the page.
Is this Tab control on the same form as the the button with the OnClick event?
0
 
wlwebbAuthor Commented:
mbizup

we may have crossed posting.......

this is a cut and paste direct from how I keyed it.......

Me.Page2.SetFocus


This is a cut and paste direct from the property sheet item NAME
Page2


Still get the Compile error......  ????????????
0
 
wlwebbAuthor Commented:
For number 3, you need to use the name of the Tab control, not the name of the page.
Is this Tab control on the same form as the the button with the OnClick event?


All the "Tabs" are in the same "Form" that form is named "frm_DataReporting"
I have currently 5 tabs

I have given the tabs a Caption

The Caption of the one I'm on with the Control button is "LVL Data Reporting"
The Caption of the one I'm trying to make the visible/active one is "LVL Control Totals"

Guess I'm not understanding what I'm looking at........ or don't understand the terminology....


All I understand is what lines I'm seeing on the Property Sheet.....  

When you say the "Name of the Tab Control"  is that not the same as NAME on the Property Sheet???????
0
 
IrogSintaCommented:
tab controlHere is a picture of a Tab control named tabSurvey which holds two pages named Page1 and Page2
0
 
IrogSintaCommented:
Interesting.  I could have sworn there was an hour since wlwebb's last post (otherwise I wouldn't have jumped in).
@Miriam, I get that too.  Sometimes I add a post that looks like no one's answered for the past hour, and then I see my post is the 4th one down with the correct answer already provided.  So I quickly delete my post.  So strange!
0
 
wlwebbAuthor Commented:
The all say TabCtl0
0
 
IrogSintaCommented:
Since you didn't rename it, that is the default name given by Access.
If you don't rename it, you would use Me.TabCtl0.Value=1 to go to the 2nd page (Index 1).

Personally I like to rename my tab controls and pages so that it's easier to follow in code.
0
 
wlwebbAuthor Commented:
Tried...... I can't get it to work....... too stupid..........

Here is a stripped out... the only thing in this is the 3 or 4 forms..... no data .....

Once it uploads I'll come back on and edit this to add the form name that starts it...

.....
Ok the main form is frm_DataReporting.

Once you open that form on the first tab, the only control button I've tried altering for this tabbed stuff is "Machine Pull"....
Tabbed-Form.accdb
0
 
wlwebbAuthor Commented:
OHHHHHH... Now I understand......!!!!!  Helps I guess if I understood all the terms....
0
 
wlwebbAuthor Commented:
Split the points between both your fixes since maybe next time I'll know the difference between the two.

Thanks Irog
0
 
IrogSintaCommented:
At least now you know
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.