469,270 Members | 1,059 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Switch Between Tabs in Navigation Form

Good day all,

Can anyone enlighten me on how to switch between tabs in navigation form? My navigation form has 5 tabs, and for some reasons I need a code to switch, between those tabs.

I have searched the web, but unfortunately nothing worked out.

Apr 22 '12 #1
16 37982
32,171 Expert Mod 16PB
I don't use tabs (or Pages) much, but I suggest you do select a control found on it to switch to it. Like Sections, I'm not aware of any way to switch focus to them directly (without selecting a specific control on them).
Apr 22 '12 #2
Thanks so much for your response; I appreciate your suggestion. However, can you tell me how to do select control found or how to implement your suggestion ?

Any idea will be much appreciateled
Apr 22 '12 #3
32,171 Expert Mod 16PB
Rather than spelling out the details in the answer, that you should include in the question, I'll wait for some sensible details and reply using those if you don't mind. It's not fun working blind at the best of times, but completely blind because you haven't included any details in your question is not how things should be ;-)
Apr 22 '12 #4
Thanks Neopa for you kind support. Yes, you are totally right; I should have included more details.

Well, as stated in my first post I have a navigation form that has 5 tabs. The navigation formís name is "ManageProfiles", and the tabs' names in order are:


On clicking on WorkingSchedule tab, I navigate to the "WorkingSchedule Form" which is embedded in the navigation subform. It allows the user to see the schedule of each employee and their courses as well. Now, I need to write a code so when user clicks on a certain course, it switched directly to the Registration Tab, and filter through the records to bring up that particular course to allow the user to change the date.

The question now is how to switch to Registration tab?

Thanks in advance
Apr 23 '12 #5
32,171 Expert Mod 16PB
Much better, BUT...

If you want code to switch to the [Registration] tab, then you need to include the name of a control that is found on that tab. A SubForm control is fine, but whichever control you choose will be selected when the switch is made.

You also need to include details of what it is that will trigger the code to run. If that is a click somewhere, then the name of the somewhere must also be included. It's a good idea to indicate names within []. It's not always necessary, but it does indicate clearly what is actually the name and what is part of your text.
Apr 23 '12 #6
759 512MB
Expand|Select|Wrap|Line Numbers
  1. TabControlName.Pages("VBA_PageName").SetFocus
or, using pages indexes,
Expand|Select|Wrap|Line Numbers
  1. TabControlName.Value = IndexValue
Apr 24 '12 #7
Neopa Thanks for your usual support. I have tried all methods of finding a control on the [Registration] tabs, but nothing worked out. Luckly, while searching the web, I found a post in a forum similar to my case. I found out that the way to switch from one tab to another in "Navigation Forms" is to change the SourceObject of the Subform Control. So, the code to carry out this task is:

Expand|Select|Wrap|Line Numbers
  1. Forms![ManageProfiles].[SubNavigation].SourceObject = "EmployeesCourses"
Note: [EmployeesCourses] is the form embeded in Subform Control of Navigation Form.

Again, Thanks for your help
Apr 24 '12 #8
Mihail, Thanks for your inputs. I believe your codes would work with on forms based on Tab Control, but not with navigation forms.

Thanks all
Apr 24 '12 #9
32,171 Expert Mod 16PB
I'm confused. Your solution doesn't fit the question at all as far as I can see.

I guess (from what you have now included in your answer) that the subform control found on the tab (Page) in question is actually called [SubNavigation] (My question #1). As such, my answer would have been (due to the lack of an answer to question #2 I can't illustrate this in context) :
Expand|Select|Wrap|Line Numbers
  1. Call Me.SubNavigation.SetFocus()
It may well be that Mihail's answer, if it works, is actually a better one anyway. I was under the impression that Tab controls could not be selected directly. Possibly I was confusing this with the fact that a reference to a control within a Tab doesn't need any reference to the Tab's name in it.

If, as seems possible now, you were really after a way of changing the form that's shown within a subform on your main form, then your solution should be :
Expand|Select|Wrap|Line Numbers
  1. Me.SubNavigation.SourceObject = "EmployeesCourses"
Apr 24 '12 #10
Try This:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo ObjectType:=acBrowseToForm, _ 
  2.                ObjectName:="EventDS", _ 
  3.                PathToSubformControl:="Main.NavigationSubform", _ 
  4.                WhereCondition:="", _ 
  5.                Page:="", _ 
  6.                DataMode:=acFormEdit
Apr 15 '14 #11
5,400 Expert Mod 4TB
Just because this thread popped up:
A few other threads about this control - for those that come across this thread - dealing with a few different issues:
Apr 15 '14 #12
Expand|Select|Wrap|Line Numbers
  1. Me!NavigationSubform.SourceObject = "FORM NAME"
FORM NAME = the page you want to open in the subform area of the Navigation form
Aug 23 '14 #13
5,400 Expert Mod 4TB
Me!NavigationSubform.SourceObject = "FORM NAME"
You will find that only works {as expected} in a tabbed form control {the code in an ACC2010 navctrl results in a fresh reload of the subform; thus the info in the prior form is lost an as writen doesn't work from within the subform}

This will not work in the new ACC2010/newer NavigationForm Control {as one would expect. The original question was modified in post #5}

The way to move from one NavigationFormControl-tab to the other {and have the data filted as requested in post #5} is to use the "DoCmd.BrowseTo" method.

Please refer to the links as provided in my prior post for more detail about the newer ACC2010/newer NavigationForm Controls. (^_^)
Aug 25 '14 #14
3,653 Expert Mod 2GB
Z, et al,

For this reason, I started this thread: Is there any Value in NAvigation Forms?

I originally thought about posting a response to this thread, but began a new one.

Z, for you to have been frustrated understanding the new Nav Forms, I know they are not for me! I'm happy loading all my subforms at once into a Tab Control and being able to keep all my data!

Aug 25 '14 #15
I place the following code in the Form_Load event of the Navigation form and it works.

Expand|Select|Wrap|Line Numbers
  1. Me!NavigationSubform.SourceObject = "FORM NAME"
As mentioned, I have two Navigation Controls, "NavigationControTop" and "NavigationControLeft". I am not sure if this is a tabbed form or normal navigation form as it is created automatically by selecting the Navigation Form Wizard.

I am sure I can solve the issue by means of one of the two following method:

First: if I can manage to activate the selected Navigation button in the "NavigationContyroTop".


Second: If I can know how to refer to the five respective groups in the "NavigationControLeft" control, with respect to the five navigation buttons in the "NavigationControTop" control.
Aug 25 '14 #16
5,400 Expert Mod 4TB
1) Well, if you used the wizard, then you most likely have the "Navigation Control"
2) Which version of access are you using?
3) Your solution of Me!NavigationSubform.SourceObject = "FORM NAME" does work as a solution to the original question as posted in #1 - provided the controls are on the main form or in the main form events.
4) I should have been clearer in reply (I will fix that after this post}:
The original question was modified in post #5(which I most likely should merge with post number one).
Your solution is already profered in post #8; however this shows the full form reference for a control within the subform and could have been shortened to:
Parent!NavigationSubform.SourceObject = "FORM NAME"
However, this code does not answer the modified question from post #5 which was to be able to pass information from one form to the next during loading of the next form. Post 11 by "Israel h" provided the solution that allows one to easily switch navigation control tabs and pass information between them.
5) You will find issues having VBA code in the main form of a navigation form. Especially if you are using a multi-tiered form (which it sounds as if you are) as demonstrated in this thread: http://bytes.com/topic/access/answer...nt-tab-clicked
This is a known bug in ACC2010 and has not been fixed as of yet for this version. I suspect that ACC2013 suffers from this as well.
6) You will need to start your own thread for what apears to be the questions about navigating to the secondary controls.
6a) Post 11 has one answer to your questions.
Aug 25 '14 #17

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Adlai Stevenson | last post: by
9 posts views Thread by pbd22 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.