Adding Macros to the ribbon in MS Access using USysRibbons

I'm new to using xml, but not new to Access or VBA. I need to create a deployable ribbon that can be customized upon load based on the users role. I am creating this ribbon using a USysRibbons table to hold the XML code. I can add built-in controls no problem. Where I am stuck is adding controls that call saved macros or procedures. Below is code I'm testing with, but line 6 doesn't work. Any help is appreciated!

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="dbChecklists" label="zChecklists" visible="true">
        <group id="dbRCL_Forms" label="Forms">
          <control idMso="Macro: macRCL_Add" label="Add" enabled="true"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Open in new window

Level7SenseiAsked:
Who is Participating?

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

x
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.

mbizupCommented:
Here's an example from one of my databases, of a ribbon button that adds a new client record.  You can call a procedure using the onAction.  The XML:

                    <button id="btnNewClient"
                              imageMso="QueryAppend"
                              label="Add new client"
                              size="large"
                              onAction="btnNewClient_Click"/>

Open in new window


The VBA:

Public Sub btnNewClient_Click(ctl As IRibbonControl)
    DoCmd.GoToRecord acDataForm, "frmClients", acNewRec

End Sub

Open in new window

0
mbizupCommented:
There are also third party tools available, such as Ribbon Creator, which make very short work of this.
0
Level7SenseiAuthor Commented:
Still no luck. I changed line 6 to the following:
          <button id="RCL_Add" label = "Add" onaction="btnAdd_RCL" enabled="true"/>

Open in new window


And I added a public procedure as you showed:
Public Sub btnAdd_RCL()
    DoCmd.OpenForm "frmRCL_Add"
End Sub

Open in new window


The XML part isn't being accepted. What am I missing? Thanks.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Level7SenseiAuthor Commented:
OK I finally got it to work. Apparently you can't use the enabled switch for a button?

          <button id="RCL_Add" label = "AddMe" onAction="macRCL_Add"  />

Open in new window

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
mbizupCommented:
Interesting!  I actually haven't tried the enabled property on a ribbon command button.  I'll check it out tomorrow... Perhaps you need a similar property such as Locked (?)
0
Level7SenseiAuthor Commented:
Primary failure was using the illegal switch of 'enabled="true"'.
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.