Access Ribbon Callback (1 Viewer)

msadiqrajani

New member
Local time
Today, 11:40
Joined
May 11, 2011
Messages
5
Hello all.

I am trying to add a callback to buttons on a custom tab but following error occurs.

Code:
Microsoft Office Access Can't run the macro or callback function 'RibExportData'.

Make sure the macro or function exists and takes the correct parameters.

Heres my Ribbon XML which is generating tab correctly.
I have added correct XML Schema...(Forum is not allowing me to post message with links as this is my first post)

Code:
<customUI 
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="BOMTAB" label="BOM Tools" visible="true">
        <group id="BOMTOOLS" label="BOM Tools">
          <button id="BOMImport" label="Import Data" enabled="true" size="large" imageMso =  "ImportExcel" onAction="RibImportData"/>
          <button id="BOMFilter"  label="Filter Data"  enabled="true"  size="large"    imageMso =  "Filter" onAction="RibFilterData"/>
          <button id="BOMExport" label="Export Data" enabled="true" size="large" imageMso = "ExportExcel" onAction="RibExportData"/>
        </group>
      </tab>
    </tabs>
  </ribbon>

My VBA Code

Code:
Option Compare Database

Sub RibImportData(control As IRibbonControl)
MsgBox "yesI"
End Sub

Sub RibExportData(control As IRibbonControl)
MsgBox "yesE"
End Sub

Sub RibFilterData(control As IRibbonControl)
MsgBox "yesF"
End Sub
 

msadiqrajani

New member
Local time
Today, 11:40
Joined
May 11, 2011
Messages
5
I found my answer...
Call back in access works differently from excel.

In xml Typed onAction function this way

Code:
<button id="BOMImport" label="Import Data" enabled="true" size="large" imageMso =  "ImportExcel" onAction="=RibImportData()"/>

And in VbA I created Public function this way

Code:
Public Function RibImportData()
MsgBox "yesI"
End Function

Now its working....
 

Users who are viewing this thread

Top Bottom