12.4. Saving a Custom Ribbon

Because you'll probably want to test your custom ribbon as you build it, let's start by talking about how to use ribbon customizations in Access. The primary way to use a custom ribbon is with a special table named USysRibbons. This section explains how you can create this table.

Access loads ribbon customizations from a USysRibbons table, which contains the fields shown in the table that follows:

Field NameData TypeDescription
RibbonNameTEXTContains the name of a Ribbon that you use in your application. You can specify the name of a Ribbon for a form, report, or database.
RibbonXmlMEMOContains the XML definition for the ribbon customization.

Alternatively, you can create this table using the following SQL statement in a DDL query:

CREATE TABLE USysRibbons
(
    RibbonName TEXT (255) PRIMARY KEY,
    RibbonXml MEMO
);

You can also create application-level Ribbons using a COM Add-in. Appendix C provides more information about writing a COM Add-in to customize the Ribbon.

To define multiple Ribbons in your application, simply add a new record to the USysRibbons table.

There is yet another way to create the USysRibbons table for use in your databases: by creating a database called Blank12.accdb. When you create a new blank database in Access 2007, Access first looks for a file named Blank12.accdb in the Office\Templates directory. If it finds one, it creates a copy of the file for your new Blank Database. If this file contains a USyRibbons table, your new database ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.