Link to home
Start Free TrialLog in
Avatar of wlwebb
wlwebbFlag for United States of America

asked on

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

SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wlwebb

ASKER

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.

????????????
Avatar of wlwebb

ASKER

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]
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).
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?
Avatar of wlwebb

ASKER

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......  ????????????
Avatar of wlwebb

ASKER

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???????
User generated imageHere is a picture of a Tab control named tabSurvey which holds two pages named Page1 and Page2
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!
Avatar of wlwebb

ASKER

The all say TabCtl0
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.
Avatar of wlwebb

ASKER

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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wlwebb

ASKER

OHHHHHH... Now I understand......!!!!!  Helps I guess if I understood all the terms....
Avatar of wlwebb

ASKER

Split the points between both your fixes since maybe next time I'll know the difference between the two.

Thanks Irog
At least now you know
:-)