Share via

Problem with access ribbon

Anonymous
2018-10-10T06:01:06+00:00

Hi All,

I am having a problem with getenabled (Enable/dissable a control/button). Opening the form doesn't disable the button but I just can't spot a problem with what I have. I have checked and double checked all names. Any help would be appreciated.

In the xml I have:

<button id="MaintClientRegion" label="Regions"

            tag="frmMaintClientRegion" onAction="ribOpenForm"  getEnabled="ControlEnabled"

              size="normal" supertip="Maintenance - Regions"/>

In a module I have:

Public Sub ControlEnabled(control As IRibbonControl, ByRef enabled)

   Select Case control.id

        Case "MaintClientRegion"

            If CurrentProject.AllForms("frmMaintClientRegion").IsLoaded Then

                enabled = False

            Else

                enabled = True

            End If

        End Select

End Sub

And on the form.. form code... I have:

Private Sub Form_Close()

If Not globalRibbon Is Nothing Then

            globalRibbon.InvalidateControl ("MaintClientRegion")

    End If

End Sub

Private Sub Form_Load()

    If Not globalRibbon Is Nothing Then

            globalRibbon.InvalidateControl ("MaintClientRegion")

    End If

End Sub

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2018-10-10T06:08:23+00:00

Stupid me.... after wasting a lot of time trying to work out the problem I realised what the problem was as soon as I posted the question... for any one interested I somehow dropped out onLoad="OnRibbonLoad" from the opening line

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="onLoadImage">

I'm not sure how to mark the question as answered..

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful