Solved

Access 2010 new NavigationControl objects - move to left

Posted on 2014-07-31
12
275 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
ID: 40231196
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
ID: 40231351
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
ID: 40232487
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
ID: 40232833
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
ID: 40232948
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
ID: 40233193
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
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 7

Accepted Solution

by:
UniqueData earned 0 total points
ID: 40233485
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
ID: 40233798
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
ID: 40234275
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
ID: 40234284
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
ID: 40243195
Came up with code that accomplished what I needed.  Points to others for their time :)
0
 
LVL 84
ID: 40243314
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

863 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

29 Experts available now in Live!

Get 1:1 Help Now