Solved Error Loading Ribbon (1 Viewer)

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Hello Folks,
i have got the following Problem, i want to load a ribbon with vba that disabels the option button for my frontend.
When i load it manually it works perfect but it doesn't work in vba.

I get the error 32610: (Name of my DB) cannot load customization 'option'. This customization name was already loaded.
But i had the standard ribbon activated before. I didn't really find much on the Internet about this Issue, I hope somebody can help :)
Thank you
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
How exactly were you loading your ribbon? If using code, can you show it to us please? Thanks.
 

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Thank you for anwering :)
The VBA Code is the following:

Dim XML As String
XML = DLookup("RibbonXML", "USysRibbons", "RibbonName = ""option""")
Application.LoadCustomUI "option", XML

The Ribbon Code is in the attached File
 

Attachments

  • Bild_2023-12-29_190139503.png
    Bild_2023-12-29_190139503.png
    9.6 KB · Views: 31

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Thank you for anwering :)
The VBA Code is the following:

Dim XML As String
XML = DLookup("RibbonXML", "USysRibbons", "RibbonName = ""option""")
Application.LoadCustomUI "option", XML

The Ribbon Code is in the attached File
I wonder if the name option is throwing it off could you try using a different name? Otherwise, you said it's okay if you load it manually. How do you do that (load it manually)?
 

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Okay, I conducted a test and named it 'rbbOption.' Initially, I didn't encounter the error immediately, but after clicking for the second time, it surfaced. I also tested it with another Ribbon, and the same issue occurred. By 'manually,' I mean navigating to File -> Options -> CurrentDB -> Ribbon and Toolbar Options. In that dropdown list, it is present, and when selected from there, it works perfectly.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Okay, I conducted a test and named it 'rbbOption.' Initially, I didn't encounter the error immediately, but after clicking for the second time, it surfaced. I also tested it with another Ribbon, and the same issue occurred. By 'manually,' I mean navigating to File -> Options -> CurrentDB -> Ribbon and Toolbar Options. In that dropdown list, it is present, and when selected from there, it works perfectly.
Are you able to share a sample db to demonstrate the issue?
 

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Yes, of course. The objective is to create a completely secure ACCDE file, and as you'll see, this is the final step. I've copied over all the relevant elements to ensure the form functions correctly. However, the bug is still present.
 

Attachments

  • TestRibbon.accdb
    1.4 MB · Views: 46

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Yes, of course. The objective is to create a completely secure ACCDE file, and as you'll see, this is the final step. I've copied over all the relevant elements to ensure the form functions correctly. However, the bug is still present.
Okay, thanks. I "think" what is happening is since you're using the system table USysRibbons, you're getting a name conflict with you try to use the same name when you try to load the ribbon. Maybe Access is automatically loading all the USysRibbons already at start up.

To get rid of the error, try using a different name than the one in the table when you run the code Application.LoadCustomUI.

Are you planning to actually use buttons in your ACCDE to load different ribbons? Please note, although the error will go away when you try my suggestion, it will come back if you click the button again.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Here's your file back... Try clicking the button now.
 

Attachments

  • TestRibbon (2).accdb
    512 KB · Views: 43

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Okay, it seems like a better solution for sure, but I'm still encountering the error on the second click. However, I've found a workaround for this error buuut the Problem is still there:

Dim FlexName As String

FlexName = "rbbBlank" & Now()

Dim XML As String
XML = DLookup("RibbonXML", "USysRibbons", "RibbonName = 'DBG'")
Application.LoadCustomUI FlexName, XML
Me.RibbonName = FlexName

MsgBox "rbbBlank set"

I'm not receiving an error message, but I'm also not experiencing any effect when I activate it using the same method. It works perfectly with your solution, the one that hides the ribbon, but not with mine that is intended to hide privacy options in accde.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Okay, it seems like a better solution for sure, but I'm still encountering the error on the second click. However, I've found a workaround for this error:

Dim FlexName As String

FlexName = "rbbBlank" & Now()

Dim XML As String
XML = DLookup("RibbonXML", "USysRibbons", "RibbonName = 'DBG'")
Application.LoadCustomUI FlexName, XML
Me.RibbonName = FlexName

MsgBox "rbbBlank set"

I'm not receiving an error message, but I'm also not experiencing any effect when I activate it using the same method. It works perfectly with your solution, the one that hides the ribbon, but not with mine that is intended to hide privacy options in accde.
Hi. I did warn you about that second click error, but I wasn't sure what you were planning to do, so I couldn't tell which approach should work for you. Were you planning to give the user an option to switch ribbons while using the app? Otherwise, why bother with using code to load the ribbons?

Also, although you eliminated the error, you ended up loading multiple copies of the same ribbon every time they clicked that button. Not sure if you wanted to do that or not.
 

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Okay, I understand what you mean haha; it seems a bit unconventional, but I get it, i explain. I want to create a completely secure ACCDE copy of the current database with a single button click and distribute it. I've set up everything in this form, which is exclusively for me (the developer) to generate the ACCDE copy and then distribute it. I've ensured security for everything, except for the privacy options, which can be accessed within the ACCDE file. Also, I'm not a fan of the ribbon; I prefer having more space in a productive environment. Hence, I want to completely disable the ribbon in the ACCDE file generated by the button click and, most importantly, turn off (hide) the privacy settings. The button should work flawlessly, except for these two modifications.
The ribbon I created earlier successfully hides the privacy settings, but the catch is, it only works when I manually insert it into the ACCDE file. Given that I want to distribute it instantly via email using this button, going in there and setting it manually becomes a bit cumbersome. XD
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Okay, I understand what you mean haha; it seems a bit unconventional, but I get it, i explain. I want to create a completely secure ACCDE copy of the current database with a single button click and distribute it. I've set up everything in this form, which is exclusively for me (the developer) to generate the ACCDE copy and then distribute it. I've ensured security for everything, except for the privacy options, which can be accessed within the ACCDE file. Also, I'm not a fan of the ribbon; I prefer having more space in a productive environment. Hence, I want to completely disable the ribbon in the ACCDE file generated by the button click and, most importantly, turn off (hide) the privacy settings. The button should work flawlessly, except for these two modifications.
The ribbon I created earlier successfully hides the privacy settings, but the catch is, it only works when I manually insert it into the ACCDE file. Given that I want to distribute it instantly via email using this button, going in there and setting it manually becomes a bit cumbersome. XD
In that case, I think you want instead is to set the DB property for the app's ribbon. Take a look at this blog.
So, somewhere in your code, you'll need to use something like the following, instead of Application.LoadCustomUI.
Code:
CurrentDB.Properties("CustomRibbonID") = "RibbonName"
You'll have to give it a try and let us know the results.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
You can try this one again; but this time, only click on the button to create the ACCDE.

PS. On my system, when I click that button, no ACCDE is created (but no error message either).
 

Attachments

  • TestRibbon (2).accdb
    528 KB · Views: 45

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Yes, I understand now, and it's working perfectly for me.

Thank you very much! :)

The idea of deleting it is clever as well.
My Idea was to created another ribbon in the USysTable that displays the standard and then I just switch back and forth.

If you're interested, I'd be happy to help you address the issue with creating the ACCDE file, as that process is currently working for me.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
Yes, I understand now, and it's working perfectly for me.

Thank you very much! :)

The idea of deleting it is clever as well.
My Idea was to created another ribbon in the USysTable that displays the standard and then I just switch back and forth.

If you're interested, I'd be happy to help you address the issue with creating the ACCDE file, as that process is currently working for me.
Glad to hear you got it working now. What version of Access are you using?
 

Spalle

New member
Local time
Today, 19:08
Joined
Dec 29, 2023
Messages
22
Glad to hear you got it working now. What version of Access are you using?
I am using the 365 Version of MS Access, but i think the function that i use for making the ACCDE is a old. Are you using this Version aswell?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:08
Joined
Oct 29, 2018
Messages
21,474
I am using the 365 Version of MS Access, but i think the function that i use for making the ACCDE is a old. Are you using this Version aswell?
I'm using 2016.
 

isladogs

MVP / VIP
Local time
Today, 18:08
Joined
Jan 14, 2017
Messages
18,227
Hi
I've only skimmed this thread but think you may find these articles helpful in fixing any remaining issues:



BTW - I tested your app using A365 - no ACCDE file was created for me nor was the reduced ribbon loaded. I didn't look at your code
 
Last edited:

Users who are viewing this thread

Top Bottom