Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2012-09-08
16
Medium Priority
?
585 Views
Last Modified: 2012-09-08
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

0
Comment
Question by:wlwebb
  • 8
  • 7
16 Comments
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 2000 total points
ID: 38379610
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
 

Author Comment

by:wlwebb
ID: 38379625
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
 

Author Comment

by:wlwebb
ID: 38379629
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 61

Expert Comment

by:mbizup
ID: 38379634
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38379637
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
 

Author Comment

by:wlwebb
ID: 38379642
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
 

Author Comment

by:wlwebb
ID: 38379646
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38379665
tab controlHere is a picture of a Tab control named tabSurvey which holds two pages named Page1 and Page2
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38379683
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
 

Author Comment

by:wlwebb
ID: 38379685
The all say TabCtl0
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38379694
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
 

Author Comment

by:wlwebb
ID: 38379707
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
 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 38379767
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
 

Author Comment

by:wlwebb
ID: 38379785
OHHHHHH... Now I understand......!!!!!  Helps I guess if I understood all the terms....
0
 

Author Closing Comment

by:wlwebb
ID: 38379788
Split the points between both your fixes since maybe next time I'll know the difference between the two.

Thanks Irog
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38379789
At least now you know
:-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question