473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Change Active Tab 2013 VBA

Hello,

I am using Access 2013.

I have Navigation Tabs when I click on a button in the form below the Tab I want to move to another Navigation tab.

I have been able to successfully Set focus from the command button in the form to the Tab I want, but I cannot get it to make that tab/page the one that is displayed.

Expand|Select|Wrap|Line Numbers
  1. //navViewOrder is the tabs name I want to go to.
  2. //NavigationControlSales is the the tab control name of which NavViewOrder is the 3rd tab.
  3.  
  4.  
  5. Private Sub cmdSaveNext_Click()
  6.     Me.Parent.navViewOrder.Setfocus = True //This works
  7.     Me.Parent.NavigationControlSales = 2 // I get Error 440 You can't assign a value to this object.
  8.  
  9. End Sub
  10.  
  11.  
Dec 19 '13 #1
4 12281
zmbd
5,501 Expert Mod 4TB
mashman:
So that we are on the same page:

- You have a form.
- On that form you have inserted the Navigation Control.
- In the Navigation Control you have a series of buttons/tabs that either run along the top, down the left side or both
- You are currently in a tab named ?
- You would like to move to a tab named "navViewOrder"

Just as an example this:



-->[2013-12-19]---> Because I don't want to lose this information about Navigation Subforms I thought, where better than to store it here? The information is a tad eaiser to find now with a search; however, still no really good explanations:

Here's the deal with the navigation control:

1) Unless renamed, the default name for the navigation control is "NavigationSubform" and we need to confirm this or confirm the name of the "NavigationSubform" control.
- To confirm this, open your form in design view.
- Show the properties dialog for any control on the form OTHER than the "NavigationSubform" - selct the parent form header or the parent form details.
- Now in the propeties box, in the dropdown, you should see either the default name of "NavigationSubform" or the name you gave it.

2) Every time you click on a navigation button/tab (NavBtn), or navigate to it using VBA, the current form is unloaded the form associated with the newly selected NavBtn is loaded. Thus, any values on the form you were on are lost unless you pass them in the calling code or store the value in a global type variable.
- in effect, this is a late binding tab form without the benfit of keeping the values from the other tabs.
- the positive, every time the form loads, it requeries and runs the onload/open/etc events.

3) It doesn't matter what NavBtn you click on, the form associated with that control is loaded and you refer to it as follows
- from the parent: me.NavigationSubform.Form![boundcontrolname]
- from within the loaded form me.[boundcontrolname]

4) To go from one navigaton control to another, you need something like this:

For a simple movement between forms, then ignore the ">" redirect as given in the link, just follow:

So I'm on a differenet form and have a command button or perhaps one of the controls has an on click for details so I need to go to the form "frm_qry_asset_inventory_logbook" for the details then:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo objecttype:=acBrowseToForm, _
  2.    objectname:="frm_qry_asset_inventory_logbook", _
  3.    PathtoSubformControl:="frm_navigation.navigationsubform", _
  4.    WhereCondition:="Inventory_pk = " & [Inventory_pk]
The "objectname" is the name of the FORM that is loaded by clicking on the NavBtn, NOT the name of the NavBtn
The "WhereCondition" is a valid SQL "WHERE" clause Select.... WHERE("Inventory_pk = " & [Inventory_pk]) this sets the filter for the loaded subform.

5) to set the focus on a control in the newly loaded subform it is a two step process you will need somethin like this:

so we move to the form "frm_loanaccounts" that loads in the navigationsubform control and we want to set focus to the combobox for new customers named "zcbo_newcustomer"
Expand|Select|Wrap|Line Numbers
  1. DoCmd.BrowseTo objecttype:=acBrowseToForm, _
  2.    objectname:="frm_loanaccounts", _
  3.    PathtoSubformControl:="NavigationForm.navigationsubform"
  4.    With Forms.Item("NavigationForm").navigationsubform
  5.       .SetFocus
  6.       !zcbo_newcustomer.SetFocus
  7.    End With
NOTE THE BANG for the control

>that should cover a few things and I hope is useful for those hunting for information about the ACC2010 and later Navigation Subform Control
Attached Images
File Type: jpg bytes_example_navsubctrl.jpg (127.6 KB, 6872 views)
Dec 19 '13 #2
1) THANK YOU - You are correct this information is a really hard find. I must have read over 500 posts over the last 2 weeks trying to do this. I think they are all talking about the old Tabbed forms more commonly used in pre 2010 access.

2) GOOGLE SEARCH TIP =>2010 - I found Google was full of lots of pre Access 2010 clutter as it was near impossible to exclude using keywords, but if you use advance search and filter results only in last 2 years, you get a higher amount of results regarding access 2010.

3) PIC - Yes your example pic is the layout I am working with.

4) WORKING -

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSaveNext_Click()
  2.     DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
  3.     ObjectName:="CustomerOrderOverview", _  //This my form attached to Navigation tab I want to move too.
  4.     PathToSubformControl:="CustomerNavigation.NavigationSubform", _ //The 1st name is the the name of the Main Navigation form that has the Navigation tab and the 2nd name is the main area directly below the tabs where the forms are.
  5.     WhereCondition:="", _
  6.     Page:="", _
  7.     DataMode:=acFormEdit
  8.  
  9. End Sub
  10.  
Dec 20 '13 #3
zu02
1
@mashman
Thank you very much, how you this find - well done!
Apr 8 '14 #4
zmbd
5,501 Expert Mod 4TB
zu02:
You're Welcome and he found the solution here.
Post#2 Point#5
Apr 8 '14 #5

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

Similar topics

11
by: Jet Leung | last post by:
Hi all, How can I modify users in Active Directory ? Actually , I want to change the Active Directory user password . But how can I do that?
0
by: Do | last post by:
Hi, I'm using the Microsoft IE Web Control for tabstrip. After a user enters some data and submits it, I want to activate another tab (and in making that tab active, I will also show another...
4
by: active | last post by:
It appears to me that if I change the Control's client size the controls size does not change to agree with the new size. Does it work like the VB6 ScaleWidth and ScaleHeight? That is after I...
1
by: Arne Tiedemann | last post by:
Hello NG, I'm new in programming VB.NET and I'll create a Project to read and change Active Directory Users, Groups, and Organisational Units. I test with VisualStudio 2003 but wenn i access Users...
3
by: Paweł S. Piotrowski | last post by:
Hello I'm writing some small application in C# just for my purpose. I want to change active window title. This feature was i.e. in foo_tbar.dll extension for foobar (music player) - when track...
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
0
by: Johnny J. | last post by:
Does anybody know how you find and change the active sound scheme in Windows programmatically? Cheers, Johnny J.
2
by: remya1000 | last post by:
i'm using VB.NET. and its a windows application. in my program i need to display a table in datagrid. so i created the table using DataTable and i'm calling that dataTable to dataGrid. and its...
3
by: Jiwei06xie | last post by:
Dear expert, I got two forms. form1: Combox form Form_rptStock (key field: serial number), with one command button. form2: Entryform Entryform_stock, with a series of command buttons. I use...
0
by: asriram1991 | last post by:
Need to validate date in C# Date should be valid only if date is 05/26/2013, 5/26/2013,6/6/2013
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.