Office Settings & Configuration

Add the Lock Icon to a Custom Microsoft Access Ribbon

Khadija KhanKhadija Khan Nov 22, 2026 869 views

Question details

Add the built-in lock icon to a button on a custom Microsoft Access Ribbon using Ribbon XML.

Add the Lock Icon to a Custom Microsoft Access Ribbon
Product
Microsoft Access
Device & OS
not provided
Scenario
A custom Access Ribbon needs a button that displays the built-in lock image.
Observed behavior
The desired button displays the lock icon through an imageMso reference and can call a VBA procedure when clicked.
Before you start

Open the Access database containing the custom Ribbon and identify its Ribbon XML and intended button callback. You will need permission to edit the database and its VBA code.

Solution 1Recommended

Add imageMso="Lock" to the Ribbon button

Use this method to display the built-in lock image and load the customized Ribbon in Access.

1
Edit the button XML

In your Ribbon XML, add a button inside a custom group, for example: <button id="buttonName" imageMso="Lock" onAction="procedureName" label="My Button" showImage="true"/>. Check that the attribute names, quotation marks, and spacing are correct.

2
Store the Ribbon XML

Create or open the USysRibbons table in the database. Store the complete Ribbon XML in its RibbonXml field and give the entry a name in the RibbonName field. If creating the table, add an AutoNumber ID field, a Short Text RibbonName field, and a Long Text RibbonXml field.

3
Select the custom Ribbon

Close and reopen the database so Access reads USysRibbons. Go to File > Options > Current Database, find Ribbon and Toolbar Options, and select the entry under Ribbon Name. Close and reopen the database again to apply it.

4
Add the button callback

In the VBA editor, add a public procedure named procedureName in a standard module with the signature Public Sub procedureName(control As IRibbonControl). Add the action you want the button to perform, and allow the database code to run if prompted.

5
Check for Ribbon errors

If the Ribbon or button does not appear, go to File > Options > Client Settings and enable Show add-in user interface errors under General. Reopen the database and use any reported errors to check the XML and callback name.

Add imageMso="Lock" to the Ribbon button
The icon does not lock anything by itself: imageMso="Lock" only supplies the button image. The callback must implement the action you want when the button is clicked.
Free Microsoft Office alternative

Use WPS Office for everyday document editing

WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations. Its familiar interface and support for common Microsoft Office formats make it easy to move existing files into your workflow. It does not customize Microsoft Access Ribbons or replace Access databases.

Work with documents, spreadsheets, and presentations in a familiar interface.Open and edit Microsoft Office formats including DOCX, XLSX, and PPTX.Use a free, lightweight Office alternative alongside Microsoft Access.
microsoft office alternative - wps office

Frequently Asked Questions

What attribute displays the lock icon on an Access Ribbon button?

Add imageMso="Lock" to the button element in your Ribbon XML. You can also include showImage="true" to explicitly show the image.

Where does Access store custom Ribbon XML?

A database can store custom Ribbon definitions in the USysRibbons table. Put the Ribbon name in RibbonName and the complete XML in RibbonXml, then select it under File > Options > Current Database.

Why does the button show a lock but not perform an action?

The imageMso attribute only controls the image. Set onAction to the name of a public VBA callback in a standard module and implement the desired action in that procedure.

How can I find errors in my custom Ribbon XML?

Go to File > Options > Client Settings and enable Show add-in user interface errors under General. Reopen the database, then check any reported XML syntax or callback errors.