Create a TAB Function for Custom Ribbon

Steveph Sanders
Steveph Sanders used Ask the Experts™
on
Running Access 2013.  Creating custom Ribbons.  Trying to streamline one of my forms that has a tab control on the form, by removing the actual  Tabs on the TabControl and setting focus to the correct tab as the user clicks the Tab on the ribbon. Not a button, but just the Tab above the buttons on the ribbon.
This is the XML for the ribbon and it works fine.  I just needs the proper way to insert an "onAction" to allow the function to run which sets focus to the correct tab.  FYI: The functions work fine too as I have already tested them with a button.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon startFromScratch="true">
<tabs>
<tab idMso="TabCreate" visible="false" />
<tab idMso="TabExternalData" visible="false" />
<tab idMso="TabDatabaseTools" visible="false" />
<tab id="VendorsTab" label="Vendors" visible="true">

@@@@  NEED A STATEMENT HERE THAT CALLS "Set Tab1 Focus"   @@@@@@

<group id="VendorGroup" label="Purchase Orders"  visible="true">
         <button id="CreatePO" label="New Purchase Order"  imageMso="QueryShowTable" size="large" onAction="=CreateNewPO()" />
         <button id="FindPO" label="Find Purchase Order"   imageMso="FindDialog" size="large" onAction="=FindPurchaseOrder()" />
</group>
<group id="POGroup" label="Vendor"  visible="true">
         <button id="EditVendor" label="Edit Vendor"  imageMso="FileCloseDatabase" size="large" onAction="=EditVendor()" />
         <button id="NewVendor" label="Create New Vendor"  imageMso="DistributionListAddNewMember" size="large" onAction="=CreateNewVendor()" />
</group>
<group id="Close" label="Close"  visible="true">
         <button id="CloseForm" label="Close" imageMso="PrintPreviewClose" size="large" onAction="=CloseForm()"/>
</group>
</tab>


<tab idMso="TabCreate" visible="false" />
<tab idMso="TabExternalData" visible="false" />
<tab idMso="TabDatabaseTools" visible="false" />
<tab id="VendorsTab2" label="Vendors2" visible="true">

@@@@  NEED A STATEMENT HERE THAT CALLS "Set Tab2 Focus"

<group id="VendorGroup2" label="Purchase Orders"  visible="true">
         <button id="CreatePO2" label="New Purchase Order2"  imageMso="QueryShowTable" size="large" onAction="=CreateNewPO()" />
         <button id="FindPO2" label="Find Purchase Order2"   imageMso="FindDialog" size="large" onAction="=FindPurchaseOrder()" />
</group>
<group id="POGroup2" label="Vendor"  visible="true">
         <button id="EditVendor2" label="Edit Vendor2"  imageMso="FileCloseDatabase" size="large" onAction="=EditVendor()" />
         <button id="NewVendor2" label="Create New Vendor2"  imageMso="DistributionListAddNewMember" size="large" onAction="=CreateNewVendor()" />
</group>
<group id="Close2" label="Close"  visible="true">
         <button id="CloseForm2" label="Close" imageMso="PrintPreviewClose" size="large" onAction="=CloseForm()"/>
</group>
</tab>


</tabs>
</ribbon>
</customUI>


Thank you,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
From what I know, there is no Tab onaction.  What about using a timer to check which tab is selected, and if it detects a change then it runs your code?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial