Link to home
Start Free TrialLog in
Avatar of Kilmiester
Kilmiester

asked on

Navigate to a specific tab in Access 2010

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

Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Is this a Web database?
Avatar of Kilmiester
Kilmiester

ASKER

No, It is not.
.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)

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




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

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.
"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 ...?
If you are referring to a tab (page) on a Tab control, this syntax works:

Me![pgeCompQuotes].SetFocus
If not, please be very specific about exactly what type of control you are referring to.
<would like to know a better way.>

This is what I posted in http:#a35216090

Helen also in http:#a35222537
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

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
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.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Wasn't an actual solution to my problem, but rather a suggestion to use another method.
<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