In this post I am going to show you how to add a customized ribbon to you Access database
so it looks like a real desktop application.
In my experience this used to be done with a main switchboard. You would control the user’s navigation
through buttons and object frames on a form. You had to program to hide and display whenever the chosen form
was opened or closed.
What makes the ribbon so nice, is that it displays over the application, and have a picturesque hierarchy of menus and sub menus to perform actions with, and it persistently stays on top of the screen.
Check out the following 2 menus:
All of the ribbon information is stored in the “USysRibbons” table in xml format.
Here is an example of the xml:
This can be broken down into 3 main segments (at least for this example):
The Tabs
The Buttons
The Groups
The buttons will load the forms in the “tag” property, and the label (caption) of the button will
be in the “label” property.
Then you can load the ribbon when the database loads by doing this:
Also, be sure to include a module called “basRibbons” which contains the following code:
Option Compare Database Option Explicit 'reference to the MS Office 16.0 Office Library - ejl 9/19/18 Public globalRibbon As IRibbonUI 'Get a global reference to the ribbon object when the ribbon loads Public Sub OnRibbonLoad(ByVal Ribbon As IRibbonUI) Set globalRibbon = Ribbon End Sub 'Open the form that is specified in the ribbon control's tag property Public Sub ribOpenForm(control As IRibbonControl) DoCmd.OpenForm (control.Tag) End Sub 'Tell a ribbon control whether it should be enabled Public Sub ControlEnabled(control As IRibbonControl, ByRef enabled) Select Case control.ID Case "Employees" If CurrentProject.AllForms("frmEmployees").IsLoaded Then enabled = False Else enabled = True End If Case "Reports" If CurrentProject.AllForms("frmReportMenu").IsLoaded Then enabled = False Else enabled = True End If Case "Calendar" If CurrentProject.AllForms("frmCalendar").IsLoaded Then enabled = False Else enabled = True End If End Select End Sub
Hope this helps so far. I will probably be modifying this over time.
Let me know if you have any questions.