Navigation control and switch between tabs nightmare!!! (1 Viewer)

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
Hi, i'm using a navigation control with 3 tabs.
I would like to open a specific tab after the user login.
I tried this but it does not work:
NavigationControlName.Tabs.Item("tabNameToOpen").SetFocus

i have tried:
Me.NavigationSubForm.SourceObject = "FormName"
then the form change but the tab selection no!
 

hubcap750

Registered User.
Local time
Today, 15:26
Joined
Jun 27, 2013
Messages
34
try this either after the docmd.openform command or the on load event:

YourFormName.YourTabControlName.Value = either 0, 1, or 2 depending on which tab you want opened.
 

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
So the tab to open would be dependent on the user that logs in? And would the other tabs (or buttons) be visible?
 

hubcap750

Registered User.
Local time
Today, 15:26
Joined
Jun 27, 2013
Messages
34
I'm not sure what you are trying to do here, but I'm going to guess that you want certain tabs visible to some users and not to others for confidentiality or security reasons. Is that what you are trying to do? If so, how many different levels are we talking about?
 

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
i tried this in the Form_Load() event:
YourFormName.YourTabControlName.Value = either 0, 1, or 2

but Access return an error: "Runtime Error: '2448': impossible to assign a value to the object."

For hubcap750 user: yes, i can disable a tab with the Enable property but i would like to open a specific tab, when the form open, if a user is belongs to a specific group.
User is in the A group: the form should open on tab 3
User is in the B group: the form should open on tab 2
 

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
Your first post and title mentions a navigation control, but now you mention a tab control. Which is it?
 

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
ohhps! yes, is the control that use the tabs.
Sorry but the translation from italian to english is "displacement control".
 

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
Ok, but are you sure it's not a Navigation Form? Double check.

If it's a Tab Control then this is the syntax:
Code:
Me.[COLOR="Blue"]TabControlName[/COLOR].Pages("[COLOR="blue"]PageName[/COLOR]").SetFocus
 

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
The PAGES property does not exist!
 

Attachments

  • tabs.JPG
    tabs.JPG
    16.1 KB · Views: 113
  • TabsControl.jpg
    TabsControl.jpg
    25 KB · Views: 122
  • TabControlIcon.JPG
    TabControlIcon.JPG
    19.1 KB · Views: 123
Last edited:

hubcap750

Registered User.
Local time
Today, 15:26
Joined
Jun 27, 2013
Messages
34
try setting the focus on a control on the tab you want the form to open to.
 

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
It is a Navigation Form, not a Tab control.

You have two options:
Code:
DoCmd.BrowseTo acBrowseToForm, "[COLOR="Blue"]NavigationTargetName[/COLOR]", "[COLOR="blue"]NameOfForm[/COLOR].[COLOR="blue"]NameOfNavigationSubform[/COLOR]"

Code:
Me.NameOfButton.SetFocus
VBA.SendKeys "{ENTER}"
... either will go in the Open (not the Load) event of the form. And the first one is preferential.
 

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
NavigationControlName.Tabs.Item("tabNameToOpen").SetFocus

after this line the tab is surrounded by a light outline but the tab does not switch.
 

Attachments

  • before.JPG
    before.JPG
    11.9 KB · Views: 125
  • After.JPG
    After.JPG
    14 KB · Views: 124

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
NavigationControlName.Tabs.Item("tabNameToOpen").SetFocus

after this line the tab is surrounded by a light outline but the tab does not switch.
I don't think hubcap realises that it's a Navigation Form and you may have missed my last post.
 

hubcap750

Registered User.
Local time
Today, 15:26
Joined
Jun 27, 2013
Messages
34
You are right vbaInet, I missed your post and didn't know it was a navigation form.
 

Gianluca

Registered User.
Local time
Tomorrow, 00:26
Joined
May 21, 2015
Messages
15
Perfect! now it works but let me say: it is not a simple implementation! maybe an ad-hoc method is better.
Thanks
 

vbaInet

AWF VIP
Local time
Today, 23:26
Joined
Jan 22, 2010
Messages
26,374
Navigation forms are not the best controls to work with.

Which option did you go for?
 

Users who are viewing this thread

Top Bottom