Solved

Navigate to a specific tab in Access 2010

Posted on 2011-03-24
17
1,850 Views
Last Modified: 2013-11-28
Is there some other way other than the Browseto command to navigate to a specific tab.  The problem I have with using browseto is that I am trying to use a generic form on multiple tabs and using the form name as the target just picks the first occurence of it.  



DoCmd.BrowseTo acBrowseToForm, "ContractorGeneric", "main.navigationsubform"

Open in new window

0
Comment
Question by:Kilmiester
  • 8
  • 6
  • 2
  • +1
17 Comments
 
LVL 84
ID: 35211194
Is this a Web database?
0
 

Author Comment

by:Kilmiester
ID: 35212004
No, It is not.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35215882
.BrowseTo will only navigate to a specific Form or Subform, it can't navigate to a specifc Tab on a tabbed control on a form.
(Please see the VBA help files on .BrowseTo)

0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35216090
Do you have to use .BrowseTo?
You can do this with OpenForm, just as well...

In any event you can do what you are asking in a roundabout way...

Put this in a module:
    Public strpubBrowseToSpec As Boolean

Put this on your code to open (Browse To) the form:
    strpubBrowseToSpec = True
    DoCmd.BrowseTo acForm, "frmTest"

Put this on the Open Event of the form to be opened:
    If strpubBrowseToSpec <> False Then
        Me.Page8.SetFocus
        strpubBrowseToSpec = False
    End If


JeffCoachman




0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35216253
It is not clear from your post or code snippet if you are referring to a "Page" or a "Tab", or even what objects you are dealing with here.

This may all be a moot point as a "Page" in the .BrowseTo method is specified for "Web Only"
...and you have stated above that this is not a Web Database...

(Many people call a Tab a Page an vice versa, so you really have to select the Object/Control, then look at the top of the property box and note the "Selection Type", ...

In other words can you clearly state *exactly* what you have here and what you are trying to accomplish?

thanks

JeffCoachman

0
 

Author Comment

by:Kilmiester
ID: 35216530
Since I posted yesterday I have scrapped my original layout so this isn't an issue for me at the moment. However I would still like to know a better way than browseto.  Want I want to know is there a way to activate a specific navigation tab control so that it will display it's target page.  
The command does work on a non web-enabled access database, but since it searches for the target page, instead of a control, I have already found other issues with it and would like to know a better way.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35217262
"activate a specific navigation tab control so that it will display it's navigation tab control "
Again, please state in detail want you are type of Objects you are referring to here You have referred to a "navigation tab control " being in a "navigation tab control ...?
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 35222528
If you are referring to a tab (page) on a Tab control, this syntax works:

Me![pgeCompQuotes].SetFocus
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 35222537
If not, please be very specific about exactly what type of control you are referring to.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35223741
<would like to know a better way.>

This is what I posted in http:#a35216090

Helen also in http:#a35222537
0
 

Author Comment

by:Kilmiester
ID: 35262527
I have tried using setfocus, but it would not work either.  None of the commands below work. I changed the flow of my form to get around this for now.

Using setfocus it does set the focus to that tab control, but it doesn't activate the tab or switch the target form in the navigation control.  

Using browseto seems to accomplish nothing.

DoCmd.BrowseTo acBrowseToForm, "Overview", Form_Projects.NavigationSubform
DoCmd.BrowseTo acBrowseToForm, "Overview", "Form.main.navigationsubform >Projects.NavigationSubform"
Form_Projects.NavigationControl0.Controls(0).SetFocus
Form_Projects.NavigationButton7.SetFocus

Open in new window

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35263361
Again, if this is not a "Web Database", why are you using BrowseTo at all?

What Helen and I posted has worked fine for me for years to select a specific tab on a Tabbed form...

here is a sample:


Database8.accdb
0
 

Author Comment

by:Kilmiester
ID: 35263761
I'm sorry I never actually specified that I'm using a navigation control. Not a tab control.  This is my first project I am doing with Access 2010, but yes,in  your example accdb is the way I would expect the navigation control to act.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 35264938
Oh...

The Nav Control is OK if you want something quick and dirty.

If you want a bit more flexibility and control, use code and objects like Helen and I suggested.

;-)
Jeff
0
 

Author Comment

by:Kilmiester
ID: 35298618
Ahh so the solution is that Navigation tabs are bad. lol.  My first time using Access 2010 to write an application and I wanted to use a combination of horizontal and vertical tabs so I'll just rotate my layout again so tab control for the top tabs, and navigation control for the verticals.
0
 

Author Closing Comment

by:Kilmiester
ID: 35298670
Wasn't an actual solution to my problem, but rather a suggestion to use another method.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35298798
<Ahh so the solution is that Navigation tabs are bad. lol.  My first time using Access 2010 to write an application and I wanted to use a combination of horizontal and vertical tabs so I'll just rotate my layout again so tab control for the top tabs, and navigation control for the verticals.>
No not bad, but they don't provide mush beyond being easy to create and looking cool.

Remember developers have been designing great looking Main Menus for "Decades", before navigation Controls came along...

When you make your own interfaces from scratch, you can do anything you want...

The main thing is to make sure the application is fully normalized and functioning, the "Navigation" should come last...

;-)

JeffCoachman
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dlookup MSACCESS 5 25
Reference Controls on subforms 7 28
Need help constructing a conditional update query 16 48
Trying to force an answer in a combobox 7 18
As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

823 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