I want a ribbon menu item (btn101) to toggle between a form that shows some data and one that doesn't show it. The line <objLint.InvalidateControl "btn101"> below gives the error message <error 91 object variable or with block variable not set>. What am I doing wrong? All suggestions welcome.
My ribbon definition contains
mod_FacButtonOnAction contains
The function mod_IsThisFormOpen works OK, as does the switching between the two forms as such (tested by commenting out the objLint.InvalidateControl line). mod_FacGetLabel contains
My ribbon definition contains
Code:
<customUI xmlns="[URL unfurl="true"]http://schemas.microsoft.com/office/2009/07/customui">[/URL]
<ribbon startFromScratch="true">
<tabs>
<tab id="tabFaciliteiten" label="Faciliteiten database">
<group id="groupFaciliteiten">
<menu id="menuFaciliteiten" label=" Faciliteiten ">
<button id="btn101" onAction="mod_FacButtonOnAction" getLabel="mod_FacGetLabel" />
</menu>
</group>
.......
</tab>
</tabs>
</ribbon>
</customUI>
mod_FacButtonOnAction contains
Code:
Sub mod_FacButtonOnAction(control As IRibbonControl)
Select Case control.ID
Case "btn101" 'show/hide data
If mod_IsThisFormOpen("frmHidden") Then
DoCmd.Close acForm, "frmHidden"
DoCmd.OpenForm "frmShown"
Else
DoCmd.Close acForm, "frmShown"
DoCmd.OpenForm "frmHidden"
End If
objLint.InvalidateControl "btn101"
Case ...
End Select
End Sub
The function mod_IsThisFormOpen works OK, as does the switching between the two forms as such (tested by commenting out the objLint.InvalidateControl line). mod_FacGetLabel contains
Code:
Public Sub mod_FacGetLabel(control As IRibbonControl, ByRef label)
Select Case control.ID
Case "btn101" 'show/hide data
If mod_IsThisFormOpen("frmHidden") Then
label = "Show"
Else
label = "Hide"
End If
End Select
End Sub