We help IT Professionals succeed at work.

Password Protect a tab on a custom Ribbon in MS Access

Lawrence Salvucci
on
180 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.
Comment
Watch Question

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lawrence SalvucciDirector of Information Technology

Author

Commented:
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?
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
I can't give you that code but perhaps Joe can ... message sent
Lawrence SalvucciDirector of Information Technology

Author

Commented:
Thank you Crystal! I appreciate your input and help!!!
Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Lawrence SalvucciDirector of Information Technology

Author

Commented:
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.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
Cool.  Pretty sure what you need is in one or more of Gunter's samples.  Keep us posted.
Lawrence SalvucciDirector of Information Technology

Author

Commented:
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.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
great! thanks for jumping in, Joe
Lawrence SalvucciDirector of Information Technology

Author

Commented:
Thank you both for your help and direction! I will post back soon!
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
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
Lawrence SalvucciDirector of Information Technology

Author

Commented:
Will do. Once I put all the code together I will post back my end solution.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
that would be great, thanks
Lawrence SalvucciDirector of Information Technology

Author

Commented:
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!
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Application Developer
CERTIFIED EXPERT
Top Expert 2007

Commented:
very c ool. thx for reporting back.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
you're welcome ~ happy to go get Joe ;) Thanks for sharing your solution
Lawrence SalvucciDirector of Information Technology

Author

Commented:
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.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
thanks. It does seem like a good way to go!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.