[AccessD] Ribbon Callbacks failing

Ryan W wrwehler at gmail.com
Tue May 25 09:27:41 CDT 2021


Well, I've got some buttons on a ribbon that go and fetch their labels
(they read out temperatures on some stuff here at the office) and icons
every 5 minutes through ribbon.invalidatecontrol objName on a hidden form.

The callbacks seem to fail when another ribbon is currently open (EG: the
print report ribbon) once the user exits out they usually get a bunch of
callback error messages (if the timer had tried to kick off the
invalidatecontrol commands on the buttons (before my fix shown below).

I could have sworn the FluentUI ribbon was supposed to queue up callbacks
until the ribbon was available and in focus (or maybe it's just in focus,
when the entire window is out of focus?)


With that in mind:

Does anyone have a way to tell which ribbon is currently loaded? The forms
don't have ribbon names bound to them, they're using the global ribbon name
in the options.  Reports have a ribbon name bound to them because I want
all of the printing ribbon stuff there.

Right now the way I'm working around it is something like:

Private Sub Form_Timer()
on error resume next
dim frmName as string
frmName = Screen.CurrentForm.Name
if (err.number <> 2475) then
    err.number = 0
    on error goto 0
    gobjRibbon.InvalidateControl "Btn1"
    gobjRibbon.InvalidateControl "Btn2"
    gobjRibbon.InvalidateControl "Btn3"
    gobjRibbon.InvalidateControl "Btn4"
end if
End Sub


Error 2475 being that Screen.ActiveForm.Name isn't fetchable because a form
isn't the currently active window on the screen.


This seems to have fixed the callbacks bombing out if the report ribbon was
currently open as far as I can tell.

Is there a better way?


More information about the AccessD mailing list