?
Solved

Access 2010 new NavigationControl objects - move to left

Posted on 2014-07-31
12
Medium Priority
?
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 1000 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 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 85
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
 
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 85
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 85
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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