Solved

Navigate to a specific tab in Access 2010

Posted on 2011-03-24
17
1,830 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
 
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
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 simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now