Part IV: Professional Database Development
1046
The CustomUI_Name and CustomUI_XML are extracted from the USysRibbons table:
Public Function LoadRibbons(strName As String)
Dim strXML As String
strXML = DLookup(“RibbonXML”, “USysRibbons”, _
“RibbonName= ‘“ & strName & “‘“)
Call Access.Application.LoadCustomUI(strName, strXML)
End Function
Access should instantly replace the invalidated ribbon with the ribbon specified by the strName
and strXML values passed to LoadCustomUI.
Completely Removing the Access Ribbon
Assume, for a moment, that there are perfectly legitimate reasons why you don’t want to use the
Access ribbons in your applications. Perhaps you’ve developed a set of effective switchboard forms,
or have mimicked the old style toolbars and menus with borderless forms. Or, your applications
are entirely forms-driven and don’t need the flexibility provided by toolbars and ribbons.
Here’s how you can completely remove ribbons from the Access interface:
- Create a new table called USysRibbons, if you haven’t already done so.
- If creating the USysRibbons table for the first time, add three fields, ID (AutoNumber),
RibbonName (text) and RibbonXML (Memo). - Create a new record with the RibbonName set to Blank.
It doesn’t really matter what you call it.
- Then add the following XML to the RibbonXML column:
<CustomUI xmlns=“http://schemas.microsoft.com/office/2006
/01/CustomUI”>
<Ribbon startFromScratch=“true”/>
</CustomUI>
- Restart the database.
- Click the File tab and select the Options button in the Backstage.
- Click the Current Database tab and scroll to the Ribbon and Toolbars area.
- In the Ribbon and Toolbars area, set the Ribbon Name to Blank (the same name you
specified for the RibbonName column in Step 3). - Close and re-open the database.
This process sets up a dummy ribbon named Blank that contains no tabs, no groups, and no con-
trols. In effect, you’re telling Access to put up an empty ribbon, which simply removes the ribbon
from the Access user interface.