Solved

Password Protect a tab on a custom Ribbon in MS Access

Posted on 2016-09-09
18
42 Views
Last Modified: 2016-09-12
I have a custom ribbon in my database with multiple tabs. Is it possible to password protect or only allow specific users to select a tab on my ribbon bar? I only want certain users to be able to access that tab's menu.
0
Comment
Question by:Lawrence Salvucci
  • 8
  • 7
  • 3
18 Comments
 
LVL 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 total points
ID: 41791226
you could have the code that processes the option process security. For instance, each FE could be identified. I like to use database properties since they are persistent even when Access is closed and opened again. Others use tables, which can be browsed. Another option is global variables but values can be lost with an unhandled error.

A good way to keep them from certain choices is not to load those options -- create multiple versions of the ribbon
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41791241
I like the idea of creating multiple versions of the ribbon but how would I have it load the correct one? I have a login form that I could grab the username from that and then load the ribbon based on a value in my tblUsers for those specific users. Right now though I have my ribbon loading via the database options under the Ribbon and Toolbar Options. Can I still have it load the regular one from there and then have it switch it after the user clicks the "Login" button on my login form?
0
 
LVL 19
ID: 41791510
I can't give you that code but perhaps Joe can ... message sent
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41791745
Thank you Crystal! I appreciate your input and help!!!
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 41791822
Whereas I have not specifically had to do this, I'm quite positive you can change the visibility of any Tab. So, you would load your custom Ribbon ...then based on user permissions ... turn tabs On/Off.  Sorry  I don't have a lot of details at the moment.

However ... if you go to Gunter's site ...  http://www.accessribbon.de/en/?Downloads ... there are 30 some sample dbs with a wealth of how to info. I have all of these on my systems.

I assume ... you ARE using Gunter's de-facto standard Ribbon Creator ??  A Must Have tool.
1
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41792024
I will look at his samples and see what I can find. I actually like that idea better where I just hide the tab based on a users permission level. I will see what I can find on there.

Yes I have his tool but I actually wrote the ribbon code myself using MS Visual Basic Express. It's a good learning experience to understand how to write the code.
0
 
LVL 75
ID: 41792112
Cool.  Pretty sure what you need is in one or more of Gunter's samples.  Keep us posted.
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41792116
Will do. Thanks for the help. I will post back once I review the sample. I found the one that will work. Just need to review it and see how I can put it into my DB.
0
 
LVL 19
ID: 41792120
great! thanks for jumping in, Joe
1
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.

 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41792121
Thank you both for your help and direction! I will post back soon!
0
 
LVL 19
ID: 41792138
you're welcome -- glad you are finding some helpful code. Please let us know what works for you.

If you need help determining the user privileges so you can determine what to show or hide, let us know that too
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41792141
Will do. Once I put all the code together I will post back my end solution.
0
 
LVL 19
ID: 41792146
that would be great, thanks
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41795185
I found my solution thanks to both of you. I am using the "getvisible" function on my ribbon. It calls the following code:

Public Sub HRISTabGetVisible(control As IRibbonControl, ByRef visible)
On Error GoTo fError
Select Case control.ID 'can be the control.tag
    Case "tabHRIS"
        If booStatusHRIS = False Then
            visible = True
        Else
            visible = False
        End If
    Case Else
        visible = True
End Select
fError_Exit:
    Exit Sub
fError:
    MsgBox "Error: " & err.Number & vbCrLf & err.Description, vbCritical, "Warning", err.HelpFile, err.HelpContext
    Resume fError_Exit:
End Sub

Open in new window


The booStatusHRIS is tied to a checkbox on my user's login form. If they have a true value on that checkbox which is stored in my tblUsers then the tab "tabHRIS" is visible. If it's false then the tab is false. I like this approach better than password protecting it. I can set this up for other tabs as well to hide it from users that do not need to see it or access it. Thank you both for your help and guidance!! I really appreciate it!
0
 
LVL 75
ID: 41795193
very c ool. thx for reporting back.
0
 
LVL 19
ID: 41795220
you're welcome ~ happy to go get Joe ;) Thanks for sharing your solution
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 41795228
You've welcome too. Just an FYI...The reason I added the HRIS to the function name and the "booStatus" was so if I use this function for other tabs then I can tell which function goes with which tab. Makes sense, right? And I do like this approach better. It just hides the tab all together so there are no passwords or anything needed. It's all controlled by the true/false values stored in my tblUsers.
0
 
LVL 19
ID: 41795242
thanks. It does seem like a good way to go!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

920 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