D
Deleted member 73419
Guest
I have a database with two forms each one using a specific ContextTab ribbon as defined within the USysRibbons table.
The form in question is using the following ribbon XML:
and the form has the following VBA code:
When the database opens, there are no errors as you would expect. But, when you open the form you get the following error:
and after hitting debug, the code stops at:
"tabContextual2" is a valid tab ID and I've even tried using the label "My Contextual Tab 2" but this does not work either.
All, I'm trying to achieve, it to activate the contextual tab when the form is active so that I don't activate the form and then have to click on the tab to use it.
Any ideas whats going on here? Thanks
The form in question is using the following ribbon XML:
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" loadImage="LoadImages" onLoad="Ribbon2OnLoad">
<ribbon startFromScratch="false">
<contextualTabs>
<tabSet idMso="TabSetFormReportExtensibility">
<tab id="tabContextual2" label="My Contextual Tab 2">
<group id="contextualGroup" label="My Group">
<labelControl id="myLabels" label="Sample 2"/>
<button id="btnDemo" size="large" label="Demo 2"/>
</group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
and the form has the following VBA code:
Code:
Option Compare Database
Option Explicit
Public MyRibbon As IRibbonUI
Function onRibbonLoad(ribbon As IRibbonUI)
On Error GoTo errorHandler
Set MyRibbon = ribbon
'Debug.Assert False
errorHandler:
Exit Function
End Function
Function Ribbon2OnLoad(ribbon As IRibbonUI)
On Error GoTo errorHandler
MyRibbon.ActivateTab "tabContextual2"
'Debug.Assert False
errorHandler:
Exit Function
End Function
When the database opens, there are no errors as you would expect. But, when you open the form you get the following error:
and after hitting debug, the code stops at:
MyRibbon.ActivateTab "tabContextual2"
."tabContextual2" is a valid tab ID and I've even tried using the label "My Contextual Tab 2" but this does not work either.
All, I'm trying to achieve, it to activate the contextual tab when the form is active so that I don't activate the form and then have to click on the tab to use it.
Any ideas whats going on here? Thanks