Access 2010 UI, Ribbons


I  have a Access-1997 database. I use custom Menubars, Toolbars. Thus hiding all default menu/toolbar options and restricting users' choices to these customized bars.

I now want to upgrade this databse to Access-2010, and want to replicate the same custom bars with ribbons.

I have created 5 new/custom tabs on the Ribbon-Bar.

Depending which form/report is open, I want the Ribbon-Bar to show only the pre-defined tabs.

I know how to hide the ribbon bar (using: DoCmd.ShowToolbar "Ribbon", acToolbarNo). But now I want the Ribbon-Bar to be visible but only showing my selected tabs.

Is this possible?

In short, how to replicate the behavior of Access-1997 customized menus/tools into Access-2010?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
It's a little bit of work, cause you need some VBA code to handle this.

You can use Gunter Avenius' WYSIWYG Ribbon Editor, which also generates the necessary VBA code.

Each control on the ribbon needs the GetVisible attribute set to a handler function VBA. There you can decide whether the control should be displayer or not. To change the ribbon, you invalidate it, which in turn calls those handlers.

<customUI xmlns="" onLoad="RibbonOnLoad" loadImage="RibbonLoadImage">
			<tab id="MyRibbonTab" label="SAMPLE">
				<group id="MyRibbonTab_Group1" label="Group Caption" getVisible="RibbonGetVisible">
					<button id="MyRibbonTab_Button1" size="large" label="Button Caption" image="some.ico" onAction="RibbonOnAction" getVisible="RibbonGetVisible" />
			<tabSet idMso="TabSetFormDatasheet" visible="false" />

Open in new window

Option Compare Database
Option Explicit

Private m_Ribbon As IRibbonUI

Public Sub RibbonOnLoad(ARibbon As IRibbonUI)

  On Local Error Resume Next
  Set m_Ribbon = ARibbon
  m_Ribbon.ActivateTab "MyRibbon"
End Sub

Public Sub RibbonGetVisible(AControl As IRibbonControl, ByRef AVisible)

  On Local Error Resume Next
  AVisible = False
  AVisible = AccessControlIsGranted(, otRibbon)
End Sub

Open in new window

Where AccessControlIsGranted() is a custom function, evaluating whether a control is shown or not.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
If each tab is in its own ribbon definition, i.e. you can set the RIBBON NAME property of the FORM to the name of your ribbon. That ribbon will then be shown when your form is active.
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Hey Anders ... welcome to Experts Exchange !
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
As noted above ... if you are going to work with Ribbons. then Gunter's tool is a MUST have !

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.