Avatar of Lawrence Salvucci
Lawrence Salvucci
Flag for United States of America asked on

Password Protect a tab on a custom Ribbon in MS Access

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.
Microsoft Access

Avatar of undefined
Last Comment
crystal (strive4peace) - Microsoft MVP, Access

8/22/2022 - Mon
SOLUTION
crystal (strive4peace) - Microsoft MVP, Access

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Lawrence Salvucci

ASKER
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, Access

I can't give you that code but perhaps Joe can ... message sent
Lawrence Salvucci

ASKER
Thank you Crystal! I appreciate your input and help!!!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Lawrence Salvucci

ASKER
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 - Former Microsoft Access MVP)

Cool.  Pretty sure what you need is in one or more of Gunter's samples.  Keep us posted.
Lawrence Salvucci

ASKER
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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
crystal (strive4peace) - Microsoft MVP, Access

great! thanks for jumping in, Joe
Lawrence Salvucci

ASKER
Thank you both for your help and direction! I will post back soon!
crystal (strive4peace) - Microsoft MVP, Access

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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Lawrence Salvucci

ASKER
Will do. Once I put all the code together I will post back my end solution.
crystal (strive4peace) - Microsoft MVP, Access

that would be great, thanks
Lawrence Salvucci

ASKER
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!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

very c ool. thx for reporting back.
crystal (strive4peace) - Microsoft MVP, Access

you're welcome ~ happy to go get Joe ;) Thanks for sharing your solution
Lawrence Salvucci

ASKER
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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
crystal (strive4peace) - Microsoft MVP, Access

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