You can use your favorite social network to register or link an existing account:
Or use your email address to register without a social network:
Sign in with these social networks:
Or enter your username and password
Forgot your password?
Yes, please link my existing account with for quick, secure access.
No, I would like to create a new account with my profile information.
I described the new Access UI in this post and this post way back in March. Now I'll run through how you program the ribbon UI using VBA. In a future post (we're still working out the content) I'll do another post on how to do the same thing using macros (so the app will run in disabled mode).
The ribbon UI presents a ton of new flexibility for us creating Access and for you building apps on top of Access that wasn't there before. As described in the posts on the ribbons, there are a lot of new control types that can be placed in the ribbon, and there's much more flexibility about how they are presented. The downside to this additional flexibility is that the ribbons are more complex to create than the old command bars. Building ribbons isn't beyond the reach of any successful Access user today, but it will take some more work. The upside is that the end product can be significantly better.
Here's an example of an application with a customized ribbon UI:
(Click image to enlarge)
The app has a rich set of controls, including a dropdown to let different users log on:
And of course after each user logs on, you can fire code to both update the contents of the ribbon itself and to take actions inside the application. Here is an example of the changes to the ribbon itself:
The application can have multiple tabs, just as Access does, and the user switches between them just as in the regular Access ribbons. Here's the Form ribbon:
In addition, custom ribbons can use the full range of controls available in Access. Here's an example of a dropdown button on the Reports tab:
And an alternate split button presentation for the same data:
Controls on the ribbons can how have "Super Tooltips" (not sure if that is the real name?). These are extra large tooltips containing more, and richer information than the command bar style tooltips, but that launch in just the same way.
There are 5 steps to customizing the ribbons:
The ribbon definition is a simple XML file and can be easily created in any text editor, but if you're using Microsoft Visual Basic.NET 2005 Express Edition or Microsoft Visual Web Developer 2005 Express Edition, you can get IntelliSense for your code. Visual Web Developer looks something like this:
You can point it at the custom ribbon schema at http://schemas.microsoft.com/office/2006/01/customui and VWD should pick up the correct file, which is called customUI.xsd. Alternately, you can download the file from http://officeblogs.net/UI/customUI.xsd.
This enables VWD to provide type-ahead IntelliSense for the correct ribbon xml.
You can see the XML file for the sample application we're building by clicking here. The contents of the file are:
Next, you need to write the routines that are called by the ribbon when an action is performed. Here's what to keep in mind when writing these routines:
In many cases, you can use a single routine for many events. For example, you might have a single subroutine that handles opening forms in your database using button controls in the ribbon. The tag attribute in the button can be used to store the name of the form, and the generic routine simply opens that form name. For example, such a routine might look like this:
Public Sub onOpenForm(control as IRibbonControl)
' Open the form which is specified in the tag attribute
' Cached copy of the RibbonUI. Used to invalidate the ribbon to
' refresh controls.
Public gobjRibbon As IRibbonUI
' customUI onLoad event handler
Public Sub onRibbonLoad(ribbon As IRibbonUI)
' cache a copy of the Ribbon so we can refresh later
Set gobjRibbon = ribbon
' Then, to refresh the entire ribbon, call:
You can look at the macros in this example database to get a better idea of the code to write.
Simply create a table in your database called USysRibbons. This table should have 2 columns:
The table should looks something like this:
Now simple create a record for each ribbon you'd like to create in the table above. Note that this is already done in the image above.
Next, you go to the Access Options dialog and under Toolbar Options, choose the ribbon for the selected object. Again, you can see these settings most easily in the attached database.
Here are a few general things to remember:
For additional resources take a look at these sites:
The next post will be the first of several drilling down into using Access in conjunction with Windows SharePoint Services.
Wow. Looks very cool. I'm going to try to use it in my app. Should be interesting...
Is the ribbon UI implemented by using the the IE rendering engine, the way some parts of the Outlook UI? It worries me if it is, as it means that Access then becomes subject to any security flaw or bug of any other kind in the IE rendering engine. Please tell us that the IE rendering engine is not used for presenting the ribbon!
Is runtime going to include the necessary Office Lib?
The ribbon rendering UI is an internal office library that is unrelated to the IE rendering engine. >> Is runtime going to include the necessary Office Lib? Sure. This is pretty fundamental to building an app.
For those of you who want to completely get rid of the ribbon--here are the steps: 1. Create a new table called USysRibbons.
2. Add two fields RibbonName (text) and RibbonXML (Memo).
3. Create a new record with the name "Blank" (doesn't really matter what you call it). Also add the following XML: 4. Restart your database.
5. Go into the Office Button | Access Options. Click on the Current Database.
6. In the Toolbars Option set the Custom Ribbon Id to Blank (name in step 3).
7. Restart the database.
I'm frankly more concerned with the new object task pane. I would like to be able to display the objects in the database in a manner similar to the old database window so that we can see more objects without having to scroll down vertically as much. As an example, I have a database that has 109 queries, 80 tables, 22 forms, 30 reports 18 modules, and several DAPs. Navigating these objects using the current pane paradigm is somewhat of a pain (even with grouping option). The problem could be solved if the current pane just provided the means to repint the object pane to allow the objects to form new columns when the pane is resized to the right. Resizing the pane now has no effect as far as the contained objects are concerned objects are concerned. It seems to me that as one resizes the pane to the right the vertical scroll bar should disappear and the objects should just appear in several rows as the view pane gets resizes to take up more of the screen. This would make devolopment much easier when working with many different objects.
Microsoft: There are 5 steps to customizing the ribbons: Create an XML File and BLA, BLA, BLA... Me: I thought Access was a RAD! RAD: Rapidity Application Developement... I hope Access 12 supports still the old toolbars!
How are toolbars & buttons controlled by code? How do you add a button to an existing toolbar using VBA? Can you add/remove and enable/disable buttons and menu items at runtime any more easily than with current versions? If you can still create toolbars and menus using VBA then it would probably be more convenient than the remarkable 5-step XML process you give above (admittedly the call-back routines would be required in any case).
>> Navigating these objects using the current pane >> paradigm is somewhat of a pain (even with grouping option). Thanks for your feedback on the navigation pane Ken. Have you discovered the search bar? Internally, we have a db that we use for hours a day every day. It is about the size of your example and growing weekly. The people using the database have found the search bar far more useful than visually scanning through a large list of stuff. We are looking into improving the keyboard model so that it is easy to get focus into the control and quickly into the details section of the pane. >> I hope Access 12 supports still the old toolbars! The old toolbars OM is still supported. If you customized your toolbar using Access 2003 those customizations still apply. If you just extended our existing menus the commands get placed in the Add-Ins tab. If you have replaced our built in tool bars then your app should run without the ribbon. We don't support UI modifications of legacy menus and command bars. >> How are toolbars & buttons controlled. There is a new method called LoadCustomUI that takes a XML string. You add callback attributes (such as getVisible, getEnabled, and so forth) to the elements in your Ribbon XML that you want to change. Here is a list of all callbacks msdn2.microsoft.com/.../ms406047.aspx. The following paper provides a pretty good overview with lots of details about Access specific details
msdn2.microsoft.com/.../ms406046.aspx. I started working with ribbon customization last week and was surprised how easy it was to pickup. The syntax of the markup language is straight forward especially with a basic XML editor that provides type ahead. We will provide more and more icons, code and ribbon samples that should help get people started very quickly. The model isn't perfect and could be easier for beginning developers; however, it does provide a rich system for building apps optimized for efficiency and discoverability.
Customizing Ribbons in Access 12 it is too much complex. We need a "Visual Editor" to do it... I have not understood if the icons must reside externally or they can be included in the FE. IMHO the matter of ribbons will be an enormous problem for Access Developers. Access 2003 "forever"? ;-) Bye P.S:
Setting reference to the Office library I have had many problems of "Lost References" with old Runtimes Edition of Access!! The only solution: www.sagekey.com
Thank you for sharing with us your knowledge. Would be possible to have a sample of your database available? Thanks, Mauro
I agree with you that a visual editor would be very cool--that was just something that couldn't get done in this release. I'm guessing third-parties will fill the gaps until we do something more native. I think you might be surprised how easy it is to pull together--especially with a few examples. You simply import the USysRibbons table and start tweaking the Label, OnAction and msoImage attributes. When the next beta is released we will post a sample database that has rich ribbons and doesn't require any code--just XML markup. The images are pulled from the Office library of images. There will be help documentation in the next beta that provides a list of all the available icons. You can load your own images from attachments with a few lines of code. We will have sample code available when folks have a build where it will work. Mauro,
The sample database is provided in a link above... clintc.officeisp.net/.../RibbonXBlogDatabase.accdb
Clint C: "You can load your own images from attachments with a few lines of code" The icons must reside externally, they cannot "embedded" in the FE?
I hope you understand that would be a very large limitation... We recommend you not underrate the problems of Runtime distribution: the "lost references" and other problems of the package wizard are much serious.
We don't want to acquire the sagekeys scripts for all the life : -) Access without a rock solid runtime distribution, is a product that has no matter. Bye
Hi chaps/chappettes I see that the icons are from the Office library and that you cannot embed them. Do they work differently from the OLE wrapper objects that previous version use? I'm just wondering if I must ship custom icons with the application in an install package (to store them externally on the client's computer) or if they could be treated as OLE objects (or better still, BLOBs)? DM
>>Have you discovered the search bar? Have not really used it yet. Will take a look at it tonight at home. Thanks for the suggestion clint! Ken