Link to home
Start Free TrialLog in
Avatar of sterlingalston
sterlingalston

asked on

Access Cannot Run the macro or callback function: Access 2013

I have a database here with the following xml loaded into the system table, USysRibbons.  I keep getting an error:

Microsoft Access cannot run the macro or callback function 'MyToogleButtonCallbackAction'

This is a sample db taken from:

http://www.accessribbon.de/en/?Downloads:1

I'm using Access 2013.

Below is the xml entry and macro code

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="MyTab" label="My Tab">
        <group id="MyGroup" label="My Group">

          <labelControl id="myLabel1" label="Sample:" />
          <labelControl id="myLabel2" label="Toogle Buttons" />

          <toggleButton id="MyToogleButton1" size="large" label="Large Toggle Button" imageMso="HappyFace"
            onAction="MyToogleButtonCallbackOnAction"/>
          <toggleButton id="MyToogleButton2" size="normal" label="Small Toggle Button" imageMso="HappyFace"
            onAction="MyToogleButtonCallbackOnAction"/>
          <toggleButton id="MyToogleButton3" size="normal"  imageMso="HappyFace"
            onAction="MyToogleButtonCallbackOnAction"/>
          <toggleButton id="MyToogleButton4" size="normal" label="Small Toggle Button"
            onAction="MyToogleButtonCallbackOnAction"/>

        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Open in new window


macro

Option Compare Database
Option Explicit

Sub CallbackCut(control As IRibbonControl, ByRef bolCancel As Boolean)
    MsgBox "Cut"
    bolCancel = True
End Sub

Sub CallbackCopy(control As IRibbonControl, ByRef bolCancel As Boolean)
    MsgBox "Copy"
    bolCancel = True
End Sub

Public Sub MyToogleButtonCallbackOnAction(control As IRibbonControl)
    MsgBox "test"
End Sub

Open in new window

SampleRibbon1.accdb
Avatar of sterlingalston
sterlingalston

ASKER

Thanks, all!
Avatar of Jeffrey Coachman
Do the other subs run?
Unfortunately I don't know.  They definitely run without the iribbon control argument.
How are you running that code?
the target macro is MyToogleButtonCallbackOnAction

i run it by clicking on any of the buttons in the My Tab
Oh, OK, sorry I thought you were using VBA,...lets see if an Expert in macros will chime in...
Um... it is VBA, but it's called from the Ribbon. Like an Excel add-in, except this is through Access system table
Then can you post a sample of this database for us to investigate?
The sample is attached in the post, right?
SampleRibbon1.accdb
1. Still not seeing how or when that ribbon code is being executed...?
2. The query needs the table "tblAccessRibbControls"
Thanks for your help, but there is not ribbon code/ macro and there is no query.  It's a system table called USysRibbons.

This article explains in a few sentences:

http://www.accessribbon.de/en/?Access_-_Ribbons:Load_Ribbons_Into_The_Database:..._Using_The_System_Table_USysRibbons

Right-click the top of the Navigation Bar "All Access Objects" and select Navigation Options, check the Box that says "Show System Objects".

There you'll find the table with all the ribbon names and xml customui code. The ribbon that loads is ID 37
access-ribbon.JPG
Any updates?

I've managed to get this working in a separate DB, but this now isn't working in the DB I've imported this to.

I have a table called 'RibbonUItbl' and a macro called LoadRibbons that contains the method     Application.LoadCustomUI rs("RibbonName").Value, rs("RibbonXml").Value

Any ideas as to settings that prevent this from even appearing?  This is on a Windows 2008 server
Sorry, I though I posted here saying that I could not recreate this here at work.
ASKER CERTIFIED SOLUTION
Avatar of sterlingalston
sterlingalston

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this fixed the issue