Microsoft Access Database: Discover The Missing Key Object When Customising The Access Ribbon Bar
Hang on a minute! With Microsoft Access 2010 you can now customise the Ribbon bar by simply going to the File tab and choose the Options commands where it’s pretty obvious what to do in the section called ‘Customize Ribbon’.
Well yes but this only applies to the general application’s Ribbon bar and is fine if you want to add your own customised icons and to be globally available to all objects. What I’m talking about is if you want to really take advantage of the Ribbon bar and making more sensitive to a form or report call (making this now a local icon) then you will need to add one missing object first.
The missing object is a table called USysRibbons, which a specially reserved named of a system table that you need to physically add in order to control localised Ribbon bars to selected forms and reports.
It requires the following steps:
Creating a special ‘system’ table (called USysRibbons)
Creating some XML code using an editor (i.e. Windows Notepad).
Setting a property in your form or report to bind the customised Ribbon Bar.
The table must have the following fields and data types (at the very least):
Name: ID, Data Type: AutoNumber (set as the primary key too).
Name: RibbonName, Data Type: Text, Size 255
Name: RibbonXml, Data Type: Memo
Save the file as USysRibbons.
Now you need to know a little XML code (may have to research this further) but the follow code is an example:
<mso:customUI xmlns:mso=””>
<mso:ribbon startFromScratch=”false”>
<mso:tabs>
<mso:tab idQ=”mso:TabPrintPreviewAccess” visible=”false”/>
<mso:tab idQ=”mso:TabHomeAccess” visible=”false”/>
<mso:tab id=”mso_c2.190AA40″ label=”Ben” insertBeforeQ=”mso:TabCreate”>
<mso:group id=”mso_c3.190AA40″ label=”Home” autoScale=”true”>
<mso:control idQ=”mso:FileOpenDatabase” visible=”true”/>
<mso:control idQ=”mso:FileNewDatabase” visible=”true”/>
<mso:control idQ=”mso:PrintDialogAccess” visible=”true”/>
</mso:group>
<mso:group id=”mso_c4.190DB43″ label=”Edit” autoScale=”true”>
<mso:control idQ=”mso:Copy” visible=”true”/>
<mso:control idQ=”mso:Cut” visible=”true”/>
<mso:control idQ=”mso:PasteSpecial” visible=”true”/>
</mso:group>
</mso:tab>
<mso:tab idQ=”mso:TabCreate” visible=”false”/>
<mso:tab idQ=”mso:TabExternalData” visible=”false”/>
<mso:tab idQ=”mso:TabDatabaseTools” visible=”false”/>
<mso:tab idQ=”mso:TabSourceControl” visible=”false”/>
<mso:tab idQ=”mso:TabAddIns” visible=”false”/>
</mso:tabs>
</mso:ribbon>
</mso:customUI>
The above code will create three sections with the following icons:
Section: Home – Open, New and Print icons.
Section:Edit – Copy, Cut and Paste icons.
Section: My Form – Customers
Paste this code into the field ‘RibbonXML’ and name it in the ‘RibbonName’ (i.e. My Form).
Now the final step is to go into the design view for your object (form or report) and set the property called ‘Ribbon Name’ for the either the Form or Report section and choose your customised name ‘My Form’ and close and save.
Job done!