Access 2010 UI, Ribbons

Hello,

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?
miky348Asked:
Who is Participating?
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="http://schemas.microsoft.com/office/2006/01/customui" onLoad="RibbonOnLoad" loadImage="RibbonLoadImage">
	<ribbon>
		<tabs>
			<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" />
				</group>
			</tab>
		</tabs>
		<contextualTabs>
			<tabSet idMso="TabSetFormDatasheet" visible="false" />
		</contextualTabs>
	</ribbon>
</customUI>

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(AControl.id, otRibbon)
  
End Sub

Open in new window


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

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.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Hey Anders ... welcome to Experts Exchange !
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
As noted above ... if you are going to work with Ribbons. then Gunter's tool is a MUST have !

mx
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.