Solved

Navigate to a specific tab in Access 2010

Posted on 2011-03-24
17
1,906 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

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…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

737 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