Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2010 ribbon label error 91

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
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
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
 
What is objLint ???

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
>What is objLint?

Thank you; this question has solved my problem! objLint is my ribbon. I now see that in the ribbon definition I had omitted the "onLoad="OnRibbonLoad" phrase from the first line
Code:
<customUI xmlns="[URL unfurl="true"]http://schemas.microsoft.com/office/2009/07/customui"[/URL] onLoad="OnRibbonLoad">
Inserting this has solved my problem.

Peter D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top