Steveph Sanders
asked on
Create a TAB Function for Custom Ribbon
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="=FindPurchaseOrd er()" />
</group>
<group id="POGroup" label="Vendor" visible="true">
<button id="EditVendor" label="Edit Vendor" imageMso="FileCloseDatabas e" size="large" onAction="=EditVendor()" />
<button id="NewVendor" label="Create New Vendor" imageMso="DistributionList AddNewMemb er" size="large" onAction="=CreateNewVendor ()" />
</group>
<group id="Close" label="Close" visible="true">
<button id="CloseForm" label="Close" imageMso="PrintPreviewClos e" 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="=FindPurchaseOrd er()" />
</group>
<group id="POGroup2" label="Vendor" visible="true">
<button id="EditVendor2" label="Edit Vendor2" imageMso="FileCloseDatabas e" size="large" onAction="=EditVendor()" />
<button id="NewVendor2" label="Create New Vendor2" imageMso="DistributionList AddNewMemb er" size="large" onAction="=CreateNewVendor ()" />
</group>
<group id="Close2" label="Close" visible="true">
<button id="CloseForm2" label="Close" imageMso="PrintPreviewClos e" size="large" onAction="=CloseForm()"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Thank you,
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="=FindPurchaseOrd
</group>
<group id="POGroup" label="Vendor" visible="true">
<button id="EditVendor" label="Edit Vendor" imageMso="FileCloseDatabas
<button id="NewVendor" label="Create New Vendor" imageMso="DistributionList
</group>
<group id="Close" label="Close" visible="true">
<button id="CloseForm" label="Close" imageMso="PrintPreviewClos
</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="=FindPurchaseOrd
</group>
<group id="POGroup2" label="Vendor" visible="true">
<button id="EditVendor2" label="Edit Vendor2" imageMso="FileCloseDatabas
<button id="NewVendor2" label="Create New Vendor2" imageMso="DistributionList
</group>
<group id="Close2" label="Close" visible="true">
<button id="CloseForm2" label="Close" imageMso="PrintPreviewClos
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Thank you,
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?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.