Switch between ribbons without reopening Access?

burma

Member
Local time
Today, 09:28
Joined
Jan 17, 2024
Messages
61
I have two ribbons in the USysRibbons table and they both work fine. However, I can't switch from one to the other without having to reopen the application.

Anyone know if there's a way to do this without having to reopen the application?

I also can't use a form to do this because once the form loses focus, the ribbon goes away. Thx
 
You can just use one main ribbon, but programmatically show/hide different tabs. Tabs can execute a GetVisible callback method, and show or hide themselves based on changing state--apart from any form--in your application.
 
use 1 ribbon and enable/disable tabs according to who is using the db.
 
You can just use one main ribbon, but programmatically show/hide different tabs. Tabs can execute a GetVisible callback method, and show or hide themselves based on changing state--apart from any form--in your application.
I'm looking into that but here's a question: any way to load that one main ribbon programmatically without having to close and reopen the application? Thx
 
Ribbons defined in USysRibbons load automatically, so there is no need to load them programmatically, or to close and reopen the app to do so. Alternatively, you can load a ribbon using the Application.LoadCustomUI() method, but then you need to pass in the Name and the XML as strings. To manage those strings it is easiest to use a table. As result, I find using USysRibbons the simplest approach.

A nice little tip, if you are working with the hidden USysRibbons table, is write a query called QSysRibbons that returns all the rows from the hidden table, like...
Code:
SELECT * FROM USysRibbons
This way you can leave all the hidden objects hidden, but your QSysRibbons query is visible in the Queries list. Or set the RecordSource of a form to USysRibbons or QSysRibbons, and edit your ribbons in that form.
 
Ribbons defined in USysRibbons load automatically, so there is no need to load them programmatically, or to close and reopen the app to do so. Alternatively, you can load a ribbon using the Application.LoadCustomUI() method, but then you need to pass in the Name and the XML as strings. To manage those strings it is easiest to use a table. As result, I find using USysRibbons the simplest approach.

A nice little tip, if you are working with the hidden USysRibbons table, is write a query called QSysRibbons that returns all the rows from the hidden table, like...
Code:
SELECT * FROM USysRibbons
This way you can leave all the hidden objects hidden, but your QSysRibbons query is visible in the Queries list. Or set the RecordSource of a form to USysRibbons or QSysRibbons, and edit your ribbons in that form.
I don't think that will work for what I need: I need an application level ribbon. So even though I can load a ribbon using LoadCustomUI, and I can select that ribbon from from the File/Options menu, that ribbon won't actually display until I restart the application. Don't think there's a way to do that unfortunately.
 
Say you need 5 ribbon tabs for one application state, and 5 completely different ribbon tabs for a different application state. Define one application level ribbon in USysRibbons with all 10 tabs. Then selectively show/hide the ones relevant to the current application state. How will that not work?

Let go of the idea that you need to change the ribbon. Use ONE ribbon, and selectively show and hide different parts of it relevant to different application states.
 
Say you need 5 ribbon tabs for one application state, and 5 completely different ribbon tabs for a different application state. Define one application level ribbon in USysRibbons with all 10 tabs. Then selectively show/hide the ones relevant to the current application state. How will that not work?

Let go of the idea that you need to change the ribbon. Use ONE ribbon, and selectively show and hide different parts of it relevant to different application states.
I like your idea of having just ONE ribbon - I can use that. My main need though is to be able to load a ribbon programmatically AND have it display in the UI without having to restart the application. Thx
 
Last edited:
You don't need to load the ribbon programmatically, you need to show/hide its features programmatically. Here's a fast and dirty sample of how it could work...
 

Attachments

another demo, it dont hide, just Disable those not of his area.
using RibbonIBDE. MS Access 2021.
 

Attachments

Users who are viewing this thread

Back
Top Bottom