This Customization Was Already Loaded (2 Viewers)

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
Apologies for the long post. Either that or likely I'll have to say I tried most of what you're going to suggest. The issue is error message 32610: "DatabaseName.accdb cannot load customization 'Main'. This customization was already loaded."

Up to now, I've avoided customizing ribbons like the plague and have spent all day on it trying to learn. As per https://docs.microsoft.com/en-us/of...to-apply-a-custom-ribbon-when-starting-access
- I have table USysRibbons with RibbonName, RibbonXML (added ID PK, auto number) later as described elsewhere with xml for Main, Main2, Main3.

- Also incorporated Application.LoadCustomUI as per
https://docs.microsoft.com/en-us/office/vba/api/Access.Application.LoadCustomUI

- I have Options>Client Settings>General "show add-in user interface errors" selected (that one seemed to point out all the errors in most db examples I downloaded about modifying ribbons). If not selected, same error.
- using <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> with Access 2016
- doesn't matter if I select a ribbon in Options or not
- doesn't matter if full or shortcut menus allowed (with or without spec'ing a ribbon)
- As long as I call Application.LoadCustomUI strRibbonName, strXml (strXml = "Main") & pass the xml as a lookup, I get the error. Values are not null
- If I pass "Main2" to function, message is about Main2; doesn't matter if a menu is spec'd in Options or not.

AFAIK, the reason for calling LoadCustonUI is to load all ribbons so that they're available for any form/report, but I can't get it to work trying to load just one.

That's all I can think of. The only thing that I seem to have accomplished is to have only Exit on File tab. I have searched all day long (thus have even looked at old posts here) and I'm not the only one who's ever asked about this. Problem is, no threads arrived at a solution anywhere. Nothing I've read indicates that ALL ribbons are loaded just because they're in a table, but is that the case? Anybody got the magic answer for the error message?
Thanks in advance.
 

isladogs

MVP / VIP
Local time
Today, 14:09
Joined
Jan 14, 2017
Messages
18,186
Hi micron
I suspect that the various custom ribbons are contradicting each other or another standard ribbon.
Can you post a database with your Access option settings and USysRibbons table
 

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
renamed autoexec so no need to bypass. Just run the macro when ready to see error message. I left Stops in the code so no need to worry about setting breakpoints.
Thanks to anyone who looks.
 

Attachments

  • AWFversion1.accdb
    484 KB · Views: 531

isladogs

MVP / VIP
Local time
Today, 14:09
Joined
Jan 14, 2017
Messages
18,186
Had a quick look at it. Didn't know you spoke Polish!

1. Using Office 2010, triggers an error in the line
<tab idMso="TabOfficeFeedback" visible="false"/>
I realise that's fine in Access 365

2. Although I've created my own ribbons, I'm by no means an expert and someone with better knowledge of ribbons may correct me on the following statement.
AFAIK you can only load one custom ribbon at a time. By that I mean one record from USysRibbons in use only.
However you can load more than ribbon within that record ...as you have done
So your Main ribbon runs fine on its own
However your startup code tries to load ribbon code Main2 triggering your error 32609
If you want Main2 or Main 3 or Main 4 then load that from Access Options.
If you want several at once you need to combine the code into one USysRibbons record

Hope that helps
 

ncwatt

New member
Local time
Today, 14:09
Joined
Feb 14, 2019
Messages
7
If you open the form in design mode and on the properties screen go down to Ribbon Name, you will have a drop down with the 4 ribbons you have setup. I've only used Main and it works fine when you put the form in to Form View.

You don't load Ribbons on top of Ribbons. Your complete XML should mark out the full ribbon bar (tabs, groups, buttons etc.).

<ribbon startFromScratch="true"> Clears all the Microsoft ones. If you set this to false your ribbons would be loaded in addition to the default ones.
 

isladogs

MVP / VIP
Local time
Today, 14:09
Joined
Jan 14, 2017
Messages
18,186
If you open the form in design mode and on the properties screen go down to Ribbon Name, you will have a drop down with the 4 ribbons you have setup. I've only used Main and it works fine when you put the form in to Form View.

Sorry but I've no idea what you are referring to here
Are you suggesting changing the ribbon in Access options which I was referring to...or something else?

You don't load Ribbons on top of Ribbons. Your complete XML should mark out the full ribbon bar (tabs, groups, buttons etc.).

I believe that's the same point as I made
 

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
AFAIK you can only load one custom ribbon at a time. By that I mean one record from USysRibbons in use only.
If I posted the right links, one of them details that a) you put a ribbon name and xml for each ribbon in the table; and b) you create a recordset, loop it, and call the function for each record to load each ribbon. That implies you can load ribbons other than the one spec'd in options, or to load ribbons when there is no ribbon spec'd in options. Either way fails. So I don't understand your point about not only being able to load only one. The M$ article implies differently. The other ribbons would be for reports and forms, not that you would have several "main" ribbons. Perhaps that is what you're thinking? Then again, I did see a reply (from Albert Kallal?) that proposed having duplicates of a ribbon, minus options not intended for the casual user, and swapping them during normal use rather than trying to add/remove ribbon functionality. This also requires additional ribbons & xml records in your table.
However your startup code tries to load ribbon code Main2 triggering your error 32609
Interesting - different number for you. Don't forget - same error results if code attempts to load Main2 if
a) no ribbon set in options;
b) Main set in options
c) any other ribbon set in options

If you want Main2 or Main 3 or Main 4 then load that from Access Options.
Your mindset seems to be around loading one main ribbon, not one main and a bunch of secondary ones related to forms/reports. Maybe this method was deprecated, but the articles aren't that old.
If you want several at once you need to combine the code into one USysRibbons record.
Not grasping that, unless you're referring to my prior comments about the article to loop a USysRibbons recordset. Don't forget, the trials I listed point out that the error occurs if you run the code even if there is no ribbon spec'd in options. That's the biggest puzzle about the whole thing. If there's no ribbon spec'd in options and you run the code, why would Access say the ribbon is already loaded when it's not spec'd in options? It behaves as if just having the table is doing the loading. At this point, I have no form to test with respect to allocating one of the secondary ribbons to it.
 

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
If you open the form in design mode and on the properties screen go down to Ribbon Name, you will have a drop down with the 4 ribbons you have setup. I've only used Main and it works fine when you put the form in to Form View.
You don't load Ribbons on top of Ribbons. Your complete XML should mark out the full ribbon bar (tabs, groups, buttons etc.).
Appreciate the input. Please review my reply to Isladogs re the M$ articles. You also seem to be of the opinion that you don't load more than one ribbon, which as I point out above, the article says you do - assuming I haven't misinterpreted it. It might help if anyone can clear up why I get the impression that looping through a recordset of ribbon names to load is an acceptable approach that might help. When I read it, I presumed you're supposed to load the ones you'll be using so that they're available to the project on demand, such as when a form opens. I didn't try setting that property in my form yet as I only intended it to be for editing the xml. BTW, I do understand the scratch thing although this issue might suggest otherwise.

In the end, I'll probably just have the table, load the main and point forms/reports to the secondary ones. Just blows me away that following the article doesn't work and seems to be contrary to everyone else's thoughts.
 

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
There is a ribbon name option on Other tab of property sheet. There are menu and bar settings as well. I guess you pick a ribbon for the form.

Forgot to apologize to the author of that xml code. I grabbed it because it looked quite robust and thought it would be a good primer for learning. It was a comment like "I've never used that many customizations in a ribbon" that attracted me to it. Hope he doesn't mind.
 

ncwatt

New member
Local time
Today, 14:09
Joined
Feb 14, 2019
Messages
7
Went for a run and had a think about it.

Do you want one ribbon which is the main one (displayed across the whole app), and then have additional ribbons displaying more options depending on the form loaded?

Using your example DB you had "Main" as the ribbon for the whole database. I've then set "Main4" to also appear when you open the form "frmRibbons". When you close the form the options on "Main4" disappear leaving just "Main" again. Is this what you're trying to achieve?
 

Attachments

  • AWFversion1.accdb
    472 KB · Views: 486

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
Do you want one ribbon which is the main one (displayed across the whole app), and then have additional ribbons displaying more options depending on the form loaded?

Using your example DB you had "Main" as the ribbon for the whole database. I've then set "Main4" to also appear when you open the form "frmRibbons". When you close the form the options on "Main4" disappear leaving just "Main" again. Is this what you're trying to achieve?
That's a good start. I think I'll have to take that approach and forget about the article. As mentioned in a prior post, when it comes to the "main" ribbon it was suggested that variations of main ribbons might be a better approach as opposed to trying to hide elements of it from unauthorized users. I suppose there's code for that, but I'm not there yet.

EDIT: Ok, I opened the db, checked that the File tab was as before (it was), added the Main2 to the form, checked it out & went to the file tab. Other additional options were there. OK, so maybe it affects that tab as well, likely due to the scratch option. I closed and reopened db and went to the File tab without opening the form and the options were different again, but not as original. Someone at M$ decided this is better and more stable than commandbars? Gimme a break.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 14:09
Joined
Jan 14, 2017
Messages
18,186
The thread has moved on a lot since I last looked at it so this may now be out of date.

sorry - I haven't had time to read the links you provided

Interesting - different number for you.



Don't forget - same error results if code attempts to load Main2 if
a) no ribbon set in options;
b) Main set in options
c) any other ribbon set in options

Your mindset seems to be around loading one main ribbon, ....

I've never tried to load a second set of ribbon code using code or a macro.
In fact prior to this I'd never heard of anyone doing so ...but that may be ignorance on my part.

You already have 2 custom ribbons added to the Main ribbon. You can add more in the same way.
AFAIK ribbons can only be added at startup.

To change ribbons would require a restart as you can see if you change it in Access options

I would recommend looking at the tutorials/examples by Gunter Avenius on his RibbonCreator site
 

Attachments

  • Capture.PNG
    Capture.PNG
    3.3 KB · Views: 1,215

Micron

AWF VIP
Local time
Today, 10:09
Joined
Oct 20, 2018
Messages
3,476
You already have 2 custom ribbons added to the Main ribbon
Hmm, so would one use <startFromScratch="false"> and just hide/show tabs instead of replacing the ribbon based on user levels?
Will go back there, but have seen that site.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 14:09
Joined
Jan 14, 2017
Messages
18,186
TBH my approach is usually as follows:
a) standard user - no nav pane or ribbon (but print preview ribbon restored whilst reports are loaded then removed when the report is closed)
b) program admin user - nav pane & ribbon visible

I try to ensure all functionality is included within my apps so that the ribbon isn't needed. My custom ribbons are for items which aren't Access features e.g.



Other than switching on/off the print preview ribbon I don't recall any examples I have of ribbon variations during program use
 

Attachments

  • HelpRibbon.PNG
    HelpRibbon.PNG
    20.8 KB · Views: 1,119

Users who are viewing this thread

Top Bottom