Solved

Access 2010 new NavigationControl objects - move to left

Posted on 2014-07-31
12
271 Views
Last Modified: 2014-08-06
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.
0
Comment
Question by:UniqueData
12 Comments
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 250 total points
Comment Utility
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
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
Comment Utility
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
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
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
 
LVL 84
Comment Utility
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
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 7

Accepted Solution

by:
UniqueData earned 0 total points
Comment Utility
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
 
LVL 84
Comment Utility
That looks like you've renamed the buttons - what about the code that runs for those buttons? How are you handling that?
0
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
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
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
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
 
LVL 7

Author Closing Comment

by:UniqueData
Comment Utility
Came up with code that accomplished what I needed.  Points to others for their time :)
0
 
LVL 84
Comment Utility
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

771 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

15 Experts available now in Live!

Get 1:1 Help Now