Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 29: Customizing Access Ribbons


1031


The ribbon produced with this XML is shown in Figure 29.17.

FIGURE 29.17

The simple Access ribbon created with the XML in Figure 29.16


The XML for the Simple1 ribbon is included in the USysRibbons table in Chapter29.accdb.
To use this ribbon, set the Custom Ribbon Id value in the Current Database options to
Simple1 and restart the application.

In Figure 29.16, notice the absence of red squiggles, indicating improperly formed XML. Visual
Web Developer flags any obvious XML errors (such as unmatched tags) by underlining suspicious
passages with red squiggles.

Keep in mind that the Visual Web Developer locates syntax errors, but cannot detect problems
with the XML’s logic. Incorrect references, misplaced or missing attributes, and other problems
with the XML’s content can still prevent your XML code from working as expected.

Notice the very top line of XML (<?xml version=“1.0” encoding=“utf-8”?>) in Figure
29.16. This line is automatically added to every XML document created with Visual Web
Developer and is not really needed by Access ribbons. However, no harm is caused if this line is
copied into the USysRibbons table.

Copying the XML from an editor such as Visual Web Developer to USysRibbons is a simple pro-
cess. Highlight the XML, making sure to include the very top (<customUI...) and bottom (</
customUI>) tags. Then, switch to Access, open the USysRibbons table, and paste the XML into
the RibbonXML column of a new row. Finally, provide a RibbonName for the new ribbon (see
Figure 29.18).

In Figure 29.18, notice that additional columns (Results and RibbonDescription) have been added
to USysRibbons, in addition to the required fields (ID, RibbonName, and RibbonXml). The
additional fields are displayed on frmUSysRibbons (shown in Figure 29.19) to help document
each ribbon in the Chapter29.accdb example database. The additional fields in no way affect
the ribbons stored in USysRibbons.
Free download pdf