Access 2010 new NavigationControl objects - move to left

Just to clarify, this is in regards to the new Navigation Buttons as part of the new NavigationControl object, not the record navigation buttons at the bottom.

On form Open I am hiding some Navigation buttons depending on a users rights.  This is fine but then I am left with blanks in the Navigation menu.  What I would like to do is shift the visible ones over to the left.

I found the following reference, but can't find any sample code (if this is even what I am looking for).  
      http://msdn.microsoft.com/en-us/library/office/ff823117(v=office.15).aspx

Anyone work with this new Navigation control?  

Here is what I have so far.  If I leave that last line (the move line) in none of the buttons appear.   (fyi, the order of the nav buttons is 1) navNew, 2) navSearch 3) navReports 4) navAdmin.

Private Sub Form_Open(Cancel As Integer)

    Me.navNew.Visible = Forms!LoginScreen!NewRA
    Me.navSearch.Visible = Forms!LoginScreen!SearchRA
    Me.navReports.Visible = Forms!LoginScreen!Reports
    
    If Forms!LoginScreen!Codes + Forms!LoginScreen!Users = 0 Then
        Me.navAdmin.NavigationTargetName = "ChangePassword"
    Else
        Me.navAdmin.NavigationTargetName = "AdminMenu"
    End If
    
    If Not (Me.navNew.Visible) Then Me.navSearch.Move 1, 0, 0, 0
    
End Sub

Open in new window


I plan on putting this in a loop once I get one figured out.
LVL 7
UniqueDataAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:
I have not used this new control, but what I generally do with my custom navigation buttons is rather than hide them, I enable/disable them, so that they remain visibile, but cannot be used.  This ensures a consistent UI where the user sees all of the controls, all of the time, but can only use those that are enabled.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I tried several different variations of the standard Move methods for Navigation Buttons and could not get them to move. It's easy to hide and disable them, but I couldn't get the Move to work. Even in design view, the only "move" I could do was to re-position them in relation to the other Nav buttons - so I could move navNew next to navSearch, for example, but I couldn't move navNew a little farther away from NavSearch.

I'm not sure about the link, but it certainly seems to indicate that the NavigationButton has a Move method - I just think perhaps that help article is wrong (and that wouldn't be the first time an access Help article was wrong!).

Also, in general I agree with Dale regarding "magical" buttons that show/hide themselves. The user interface should be consistent, which would dictate that buttons do not magically appear. That said, if you have processes that should only be available to certain classes of users - like Admin functions, for example - then most UI design guides say it's okay to NOT show them to other classes of users. If you have processes that can change based on the "state" of the application/data - for example, you cannot Print a form until certain bits of data are filled out - then you'd disable the button until the correct "state" is reached.
0
UniqueDataAuthor Commented:
I didn't want users that didn't have access to the reports to see that there is a reports tab...I can see the support calls coming in that their reports tab doesn't work :)  

But it looks like I am stuck with that option.  So, with that way of going I have a problem.  If the first tab is not enabled, it still loads that tabs subform.  I tried to setFocus on the next available tab but that didn't work.  What method should I be using?
    If Me.navNew.Enabled Then
        strFirst = "navNew"
    ElseIf Me.navSearch.Enabled Then
        strFirst = "navSearch"
    ElseIf Me.navReports.Enabled Then
        strFirst = "navReports"
    Else
        strFirst = "navAdmin"
    End If
    Debug.Print strFirst
    Me(strFirst).SetFocus

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Jeffrey CoachmanMIS LiasonCommented:
Just a commentary here...so no points are wanted.
;-)

I didn't want users that didn't have access to the reports to see that there is a reports tab...I can see the support calls coming in that their reports tab doesn't work :)

Agree with Dale here as well, ...note what he says:
what I generally do with my custom navigation buttons is rather than hide them,  I enable/disable them, so that they remain visible, but cannot be used.

All of these new controls in Access are slick, ...but unless you have full control over them, you may always run into headaches trying to modify/customize them, ...
...Build your own, and you can do whatever you like.
(within reason)
;-)

If you used a standard tab control, you could disable the reports tab for certain users, then it would appear "greyed/dimmed".
Most users know what this visually means because this UI technique is used in most every modern application.


I can see the support calls coming in that their reports tab doesn't work :)  
In your case, you will still get service calls asking why certain tabs appear and disappear...
;-)
Again, making certain controls visible and invisible goes against current UI design.
Disabled/Greyed/Dimmed is the more standard approach (as the other experts stated)

;-)

JeffCoachman
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Or you could have multiple Navigation Forms for each user "class". That's a maintenance headache, of course, but it'll do what you want.

Still, I'd seriously look into Dale's suggestion of building your own navigation form. The new Navigation Form was really created to provide navigation options for Web-based applications, and while you can use them on the desktop I find them ... kludgy and klunky.
0
UniqueDataAuthor Commented:
I hear ya. I had used that type of loading varios subforms into a single control before so was excited to see it built into 2010. But didnt realize it had these limitations.

So nobody knows how to 'set focus' on a different "tab"?
0
UniqueDataAuthor Commented:
ok, so I used Microsoft's Navigation control but tweaked it with code, keeping it somewhat flexible..

Private Sub Form_Open(Cancel As Integer)
Dim intNavNumber As Integer
Dim intLoop As Integer
Dim strNavOptions(3, 1) As String
    
    strNavOptions(0, 0) = "NewRA": strNavOptions(0, 1) = "New RA"
    strNavOptions(1, 0) = "RASearch": strNavOptions(1, 1) = "RA Search"
    strNavOptions(2, 0) = "Reports": strNavOptions(2, 1) = "Reports"
    strNavOptions(3, 0) = "Admin": strNavOptions(3, 1) = "Admin"
    
    'hide all nav buttons
        For intLoop = 1 To 4
            Me("nav" & intLoop).Visible = False
        Next intLoop
    
    intNavNumber = 0
    
    'enable based on rights on login screen
        For intLoop = 0 To 3
            If Forms!loginscreen(strNavOptions(intLoop, 0)) Then
                intNavNumber = intNavNumber + 1
                Me("nav" & intNavNumber).Visible = True
                Me("nav" & intNavNumber).Caption = strNavOptions(intLoop, 1)
                If strNavOptions(intLoop, 1) = "Admin" Then  'admin is a bit different
                    If Forms!loginscreen!Codes + Forms!loginscreen!Users = 0 Then
                        Me("nav" & intNavNumber).NavigationTargetName = "ChangePassword"
                    Else
                        Me("nav" & intNavNumber).NavigationTargetName = "AdminMenu"
                    End If
                Else
                    Me("nav" & intNavNumber).NavigationTargetName = strNavOptions(intLoop, 0)
                End If
            End If
        Next intLoop
    
    'set opening screen to first navButton
        Me.NavigationSubform.SourceObject = Me.nav1.NavigationTargetName
        
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
That looks like you've renamed the buttons - what about the code that runs for those buttons? How are you handling that?
0
UniqueDataAuthor Commented:
Thats one of the beauties of that control. Just take care of the properties and the control takes care of switching the subforms out and the mouse over effects, etc.
0
UniqueDataAuthor Commented:
In the future I may want to use a table instead of an array to make it a little more reusable for other projects.
0
UniqueDataAuthor Commented:
Came up with code that accomplished what I needed.  Points to others for their time :)
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Thanks for the points, but in the future please don't feel the need to award points for our "time". We should only be awarded points if we contribute toward your solution ...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.