UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Load Custom Ribbon, Access 2016    
 
   
mrpersonality
post Nov 19 2019, 05:31 PM
Post#1



Posts: 476
Joined: 4-December 02
From: NSW Australia


I use Application.LoadCustomUI to load a custom ribbon in my application at start up
all works as expected until I get a runtime error from anywhere in the program
while I don't want runtime in errors in my finished application,while testing of course I will get plenty
my question is - is there anyway to check whether the ribbon has been loaded prior to using Application.LoadCustomUI
the error is "This Customisation name was already loaded" and it seems no way of trapping it
I have to completely exit access and start again
I would like to alter my code to first check if the ribbon has been loaded,and if not then use Application.LoadCustomUI
Go to the top of the page
 
theDBguy
post Nov 19 2019, 08:23 PM
Post#2


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Just curious, how/when/where are you loading the Ribbon? Are you using the OnLoad call back? If so, I wonder if it's possible to use that to check and maybe cancel the Ribbon if previously loaded already.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
mrpersonality
post Nov 19 2019, 09:20 PM
Post#3



Posts: 476
Joined: 4-December 02
From: NSW Australia


I load it when my main form loads by just calling my load procedure - the main form being a navigation form ( basically a switchboard)
I don't call it using any built in function
how would I go about using the onload call back ?
ideally would be nice to know where the customisation setting is stored-its certainly not the ribbon table because I check it for a record-if its empty you would think the ribbon hasn't been loaded
but that's not the case,you can have an empty table but still have a loaded customisation,even though that customisation(ribbon) doesn't exist in the ribbon table
Go to the top of the page
 
theDBguy
post Nov 19 2019, 10:33 PM
Post#4


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Can you post a sample XML of the custom Ribbon you're loading? Thanks.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
mrpersonality
post Nov 19 2019, 10:58 PM
Post#5



Posts: 476
Joined: 4-December 02
From: NSW Australia


here it is
I load this into the ribbon table - and delete it when the reports that use it are done
it works -no run time error no problems
<!-- Created with IDBE RibbonCreator 2019 (Version: 1.1002) -->
<!-- http://www.RibbonCreator2019.de -->

<!--Images are store in current Database - Do NOT delete this remark-->

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
<ribbon startFromScratch="true">
<tabs>
<tab id="tab0" label="Print" getVisible ="GetVisible" tag = "RibbonName:=Mbt_Custom_Ribbon;CustomTagValue1:=;CustomTagValue2:=;CustomTag
Value3:=" >
<group id="grp0" autoScale="false" centerVertically="false" label=" " getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=
;CustomPicture:=;CustomPicturePath:=" >
<button id="btnIDMsoCloseDocument" size="large" label="Close...." screentip="Click To Close Report" supertip=" " imageMso="CloseWeb" tag="RibbonName:=Mbt_Custom_Ribbon;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;
CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
<group id="grp1" autoScale="true" centerVertically="false" label=" " getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=
;CustomPicture:=;CustomPicturePath:=" >
<button id="btn1" size="large" label="Print..." screentip="Select Print Options" supertip=" " getImage="GetImages" tag="RibbonName:=Mbt_Custom_Ribbon;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;
CustomTagValue3:=;CustomPicture:=Printer.bmp;CustomPicturePath:=C:\Users\Bruce\Desktop\Mbt_Data_Files\Images\Bmaps\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
<separator id="sep4" getVisible="GetVisible" />
<button id="btnIDMsoFileSaveAsPdfOrXps" size="large" label="Pdf..." screentip="Save As Pdf File" supertip=" " getImage="GetImages" tag="RibbonName:=Mbt_Custom_Ribbon;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;
CustomTagValue3:=;CustomPicture:=Pdf2.png;CustomPicturePath:=C:\Users\Bruce\Desktop\Mbt_Data_Files\Images\Bmaps\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
<separator id="sep_5" getVisible="GetVisible" />
<button id="btnIDMsoPublishToPdfOrEdoc" size="large" label="Email" screentip="Email As Pdf" supertip=" " getImage="GetImages" tag="RibbonName:=Mbt_Custom_Ribbon;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;
CustomTagValue3:=;CustomPicture:=email.bmp;CustomPicturePath:=C:\Users\Bruce\Desktop\Mbt_Data_Files\Images\Bmaps\" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
<group id="grp2" autoScale="false" centerVertically="false" label=" " getVisible ="GetVisible" tag = "RibbonName:=;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=
;CustomPicture:=;CustomPicturePath:=" >
<button idMso="PageSetupDialog" showLabel="false" size="large" label="Page Set Up" tag="RibbonName:=Mbt_Custom_Ribbon;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;
CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Go to the top of the page
 
KBell
post Nov 20 2019, 12:00 AM
Post#6


UtterAccess VIP
Posts: 4
Joined: 7-December 02
From: Redmond, WA


As far as I know, there is no way to check which Ribbons have been loaded or a method to unload a Ribbon. I think the best you can do is trap runtime error 32610.

Why are you deleting the Ribbon entry from Ribbon table? Are you generating the XML dynamically?

--------------------
Kevin Bell
Creator of the AccessUI Ribbon & Tree Builder
and Former Microsoft Access Test Team Member
Go to the top of the page
 
mrpersonality
post Nov 20 2019, 12:10 AM
Post#7



Posts: 476
Joined: 4-December 02
From: NSW Australia


I have error trapping and it doesn't fire when the error occurs
I only have one ribbon,and have had hit and miss success with showing and hiding ribbons using the showtoolbar command
I find the way I use it it always works as I expect it to-runtime error being the only problem
access must store some a reference to a loaded customisation somewhere to generate the error
was just hoping to find that-if not then just have to run with what I have

Go to the top of the page
 
KBell
post Nov 20 2019, 02:06 AM
Post#8


UtterAccess VIP
Posts: 4
Joined: 7-December 02
From: Redmond, WA


Going off memory here so I could be off the mark a bit…

All Ribbons in the sysRibbons table are loaded when the database starts. A Ribbon will show globally if it is set in the Access Options for the database. A Ribbon will also show if it is set on a form or report’s Ribbon Name property, and that form or report has focus.

Application. LoadCustomUI is for loading Ribbons stored in a table other than usysRibbons, or ones created on the fly.

Once a Ribbon is loaded in memory, I don’t think it really matters how it was loaded (usysRibbons or LoadCustomUI), you can access it on any form or report. Loaded Ribbon names have to be unique. If you try to load two Ribbons with the same name you should get an error.

DoCmd.ShowToolbar "Ribbon", acToolbarYes/No turn the entire Ribbon on or off, I don’t think you can load a specific Ribbon ShowToolbar.

--------------------
Kevin Bell
Creator of the AccessUI Ribbon & Tree Builder
and Former Microsoft Access Test Team Member
Go to the top of the page
 
isladogs
post Nov 20 2019, 02:41 AM
Post#9


UtterAccess VIP
Posts: 1,925
Joined: 4-June 18
From: Somerset, UK


Perhaps I'm being dense but I don't understand why you are using Application. LoadCustomUI rather than loading the ribbon through Access Options.
Similarly I'm not clear what you mean by deleting it other than hiding the ribbon
To save reinventing the wheel, could you upload a sample app with the custom ribbon so we can assist better.

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
mrpersonality
post Nov 20 2019, 04:45 AM
Post#10



Posts: 476
Joined: 4-December 02
From: NSW Australia


the application is way to big to upload
As I explained,i have had hit and miss success trying to show and hide ribbons
what I do works-once I have finished debugging it wont be an issue
if there was a simple way to check what is loaded I would have used it,but as it appears there is no way then I will live with what I have
Go to the top of the page
 
isladogs
post Nov 20 2019, 06:02 AM
Post#11


UtterAccess VIP
Posts: 1,925
Joined: 4-June 18
From: Somerset, UK


There is no need to upload the full app.
Make a copy of it to include your ribbon and just the database objects needed to see the issue.
Remove all data except a handful of records and modify the data if confidential. Compact and zip.

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
theDBguy
post Nov 20 2019, 12:34 PM
Post#12


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Thanks for posting the XML and sorry for the delay, but this is what I was looking for:
QUOTE (mrpersonality)
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
Specifically, the part I bolded above. I was thinking maybe in your onLoad callback, you can do something to check if the Ribbon was previously loaded already and then react accordingly. Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
mrpersonality
post Nov 20 2019, 03:07 PM
Post#13



Posts: 476
Joined: 4-December 02
From: NSW Australia


thanks Dbguy
I will see what I can do with that
Go to the top of the page
 
theDBguy
post Nov 20 2019, 03:13 PM
Post#14


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


It was just a thought. Please let us know how it goes... Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
mrpersonality
post Nov 20 2019, 03:14 PM
Post#15



Posts: 476
Joined: 4-December 02
From: NSW Australia


I will get back to you-it may take a day or I have other work I have to get done first
Go to the top of the page
 
mrpersonality
post Nov 20 2019, 06:27 PM
Post#16



Posts: 476
Joined: 4-December 02
From: NSW Australia


Dbguy
that call back only fires when the report that uses it opens,so that's not going to work as the error occurs before that happens
its not a big drama for me to leave it as is,the problem only arises when I am testing and debugging,and fixing it just
means I close and re-open the database
thank you for your efforts in trying to find a solution

Go to the top of the page
 
theDBguy
post Nov 20 2019, 06:51 PM
Post#17


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Huh, oh well. I was hoping the onLoad callback fires every time you "load" the Ribbon, as its name implies. Sorry.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    16th December 2019 - 02:13 AM