MS Access 2013 - Custom Ribbon won't work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    MS Access 2013 - Custom Ribbon won't work

    OK. So for about a million years, since MS Office has been using their ribbons, I've been able to create a Custom Ribbon that I use exclusively for my Reports:

    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
        <ribbon startFromScratch="true">
            <tabs>
                <tab id="dbCustomTab" label="Reports" visible="true">
                    <group id="dbCustomGroup" label="Report Functions">
                        <control idMso="PrintPreviewZoomMenu" label="Zoom" enabled="true"/>
                        <control idMso="PrintPreviewClose" label="Close" enabled="true"/>
                        <control idMso="PrintDialogAccess" label="Print" enabled="true"/>
                        <control idMso="FileSaveAsPdfOrXps" label="PDF" enabled="true"/>
                    </group>
                </tab>
            </tabs>
        </ribbon>
    </customUI>
    I turn off all the toolbars and menus and then, when someone generates a report, the Reports Ribbon appears, because it is assigned to the RibbonName Property of each of my reports.

    This has worked flawlessly since the Dark Ages.

    One of my co-workers recently was upgraded to MSO 2013. The Reports ribbon no longer showed up, and all of a sudden, the Print Preview Ribbon started showing up on his reports. But, he was unable to use any of the built in buttons for that ribbon.

    Now, the rest of the office has been upgraded to MSO 2013 (including your friendly local Database Administrator), and now the custom Ribbon does not work for anyone.

    Any ideas why this works this way (or more correctly, doesn't work)?

    Any suggestions for the dreaded "workaround "? I think one workaround might be to turn the toolbars back on every time there is a report generated.

    I also don't want to add "Print" and "Close" buttons to all of my reports, either.

    Any advice or insight would be appreciated.

    Grace and peace!
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    My workaround has been to not use Access 2013. At work I have both Office 2010 and Office 2013 installed. I use Access 2010, but everything else I use 2013. I'm not sure if this is an option for you, but it does work. While I have never done much with custom ribbons, I really don't care for Access 2013 or 2016 due to some other issues.

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3662

      #3
      Seth,

      Unfortunately, that is not an option for us. We have managed systems. Plus, if others had 2013 and I did not, some of the "standard" functions like Date() would not even work with those systems. Crazy, huh?

      Overall, I just hate the new MSO 2013, the interface, the appearance, the headaches it's causing. All around not happy!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32659

        #4
        Hi Twinny.

        This may be a red herring, but the only time I worked with ribbon customisation, which was in Excel and not in Access, I found that the underlying XML was stored under a different-named heading for 2007 and 2010. Admittedly, I was under the impression that everything after 2010 would stay in the same place, but I never went further.

        I suspect you'll need to replicate your customisation work specifically for 2013.

        It's just an idea. I can't say if it's right or not.

        HTH -Ade.

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3662

          #5
          Thanks, Ade,

          So, the Sargasso becomes thicker....

          No help with reduplicating the XML, but it was worth a try.

          So here's a strange workaround, but not a solution:

          When we open a report in the DB, we can use keyboard shortcuts, such as Ctrl-P to bring up the Print Menu and Esc, to just close the report.

          But..... Here is the really strange thing, when we bring up the Print Menu that way, and then print to PDF, after the PDF is created.... Voilá! The Reports Ribbon magically appears!

          From that point on, as long as the user stays in the DB, the reports ribbon works. I've been experimenting with ways to "force" the DB to think that it is exporting to PDF (OutputTo Method, etc.,) but no such luck.

          I'm wondering what is "behind" this behavior? If I understood that, then I would at least have a direction to go for trouble-shooting. For now, I'm just blind-folded, in the dark, throwing darts backward at a dartboard that's behind a brick wall while I'm hanging upside down with my hands behind my back, using headless and finless darts--in a hurricane.... Or something like that.

          Any outside-the-box ideas?

          :-)

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            Are you specifically turning off teh ribbon toolbar? Then I imagine that would do it for you, and cause weird behavior. If that is the case, I would say its more of a bug in 2010 that it worked at all.

            Workarounds I can think of:
            Create a (non-dialog) popup form that opens when the report opens, and closes when it closes again, with the functionality required.

            Re-enable the ribbon, and have a blank default ribbon.

            You *could* try to use the reports activate/deactivate event to turn on/off the ribbon toolbar, but I have no idea if that would be "flaky" in use.

            Comment

            • zmbd
              Recognized Expert Moderator Expert
              • Mar 2012
              • 5501

              #7
              TwinnyFo,
              How are you calling your ribbon?

              I have only the default library references set and no ribbon callback code at this point in the test database

              I created the TwinnyRibbon using the table method.

              I had no issues when using this as the default ribbon at start-up in the database
              (File>Options>C urrent Database>Ribbon and Toolbar Options>Ribbon Name)

              If I set the above option to none and attached TwinnyRibbon to a report, then only the <FILE> ribbon shows when the report opens.

              If I set the above option to a test ribbon I've been working on, set that ribbon's <ribbon startFromScratc h="true"> leave TwinnyRibbon attached to the report
              >My ribbon opens fine with the database
              >Report opens and my ribbon disappears and TwinnyRibbon replaces my ribbon.
              >Closing the report, my ribbon returns.

              If I set my test ribbon <ribbon startFromScratc h="false">, have it start with the database and leave your ribbon attached to the report. When the report opens only the <FILE> option is visible.

              If I set the library reference for Microsoft Office 15.0 Object Library:
              > Leave my ribbon as the default startup for the database,
              > leave <ribbon startFromScratc h="false">
              > leave TwinnyRibbon attached to the report.

              When I close and reopen my database:
              > my toolbar shows as a tab in the default ribbon.
              > Opening the report, TwinnyRibbon replaces the default ribbon.
              > Closing the report and the default ribbon returns.

              IMHO, if you do not want to set the MSO15OL then create a default Ribbon, set the on <ribbon startFromScratc h="true">, set this ribbon to start with the database options.

              MSOffice2013(32 Bit) on Win7Enterprise( 64Bit)
              -Z
              Last edited by zmbd; Apr 28 '16, 05:31 PM.

              Comment

              • twinnyfo
                Recognized Expert Moderator Specialist
                • Nov 2011
                • 3662

                #8
                Z,

                Great insight, as usual, and thank you for testing several iterations. I have replicated your iterations with no success.

                The only way I can always get the ribbon I want to show up for my reports is to have the reports Ribbon be the default ribbon for the DB. This is not really a problem, because the reports are the only part of the DB in which people can use the ribbon.... so I'm good with that.

                But, again, and this is the extremely strange part: Every time I DO get the ribbon I want to show up, it is disabled. But, when I Ctrl-P and then print to PDF, the functionality "magically" is enabled. Then, no matter how long I stay in the db, the ribbon runs perfectly. This same behavior occurs both before and after creation of the .accde file.

                I just can't figure out what is causing this behavior. Hence, Goofy scratching his head, yet again!

                Comment

                • nnoam1
                  New Member
                  • Apr 2016
                  • 1

                  #9
                  I tried your ribbon with my Access2013 and it works well! It seems that you open your reports in acViewReport view. Isn't it?
                  If that's the case - some of your ribbon controls are unavailable.
                  Instead, use acViewPreview - and the ribbon will function alright!
                  Can you write here your OpenReport code?

                  Comment

                  • zmbd
                    Recognized Expert Moderator Expert
                    • Mar 2012
                    • 5501

                    #10
                    nnoam1:
                    The way I understand TwinnyFo, and the behavior I saw during my tests, is that the custom ribbon tab does not show up at all.

                    TwinnyFo:
                    + Even with the MSO15OL reference set?
                    + I'll have to try making an *.ACCDE file.
                    + I suspect that TheSmileyCoder has HTNOTH here with a bug in implementation.

                    curious indeed!

                    Comment

                    • twinnyfo
                      Recognized Expert Moderator Specialist
                      • Nov 2011
                      • 3662

                      #11
                      nnoam1,

                      I am opening my reports in AcViewPreview mode. Always have.

                      ===============

                      Z,

                      With or without MSO15OL--same results.

                      Very curious--per your PM, I'll send something your way. I Really, truly HOPE you encounter the same results!!!!

                      Comment

                      • twinnyfo
                        Recognized Expert Moderator Specialist
                        • Nov 2011
                        • 3662

                        #12
                        OK Friends, this must be the STUPIDEST solution I have ever found for working with MS Access VBA. But, you might get a few laughs out of this one.

                        Anyway, all my efforts have been focused on MS Office 2013 and the VBA solutions that might be found within, but my office mates and I observed some very strange behaviors with this ribbon. As mentioned earlier, when we hit Ctrl-P and printed to PDF, the ribbon magically appeared and functioned as expected. I was unable to achieve results by programmaticall y printing the report to PDF.....

                        However, we also noticed something even stranger. I was using the DB earlier today, but was not printing any of the reports. During the normal course of my work, I was distracted with some other projects (with the DB still open). I went back to the DB, opened a report and violin! The ribbon worked perfectly. Very strange.

                        Closed the DB, opened again, and the ribbon was kaput, as expected. Hmmmmm... I had to open an older file--in PDF format--for some other work. Ahh--I need to check something in the DB. Open a Report--Ribbon works fine!!!!

                        Hmmmmm.... Let me test this again.... Restart PC.... Open DB.... Ribbon no worky.... Open PDF.... Ribbon worky!!!

                        So, my "SOLUTION" is a work around, at best. I added the following code to the opening actions of the DB.

                        Code:
                            FollowHyperlink "\\Server\Path\Folder\DUMMY.pdf"
                            SendKeys "^w", True
                        Dummy.pdf is just a blank page that I saved as a PDF. Now, when I open the DB, the ribbon works. Doesn't make any sense, because these two software applications are in no way related--not even made by the same company. But it works!





                        DUMBEST



                        THING



                        EVER!!!!!!!




                        Have a great weekend, y'all!

                        Comment

                        • zmbd
                          Recognized Expert Moderator Expert
                          • Mar 2012
                          • 5501

                          #13
                          Shell Function
                          Shell the PDF and then no need for the sendkey
                          Not sure how to close the Shelled program

                          Windows API ShellExecute() function
                          I've played with this one too a bit trying to be able to close the shelled program; however, the APIs are a bit new to me and with the 64-Bit platform potential you have to allow for that:
                          64-Bit Visual Basic for Applications Overview

                          In both cases I was working on a way to automatically roll-out new versions of the frontend. :)

                          In the meantime I've not had a chance to look at the file you sent. Been a very long and busy day - dealing with family issues... :-(

                          Comment

                          • zmbd
                            Recognized Expert Moderator Expert
                            • Mar 2012
                            • 5501

                            #14
                            I opened the file you sent on my home pc,
                            Windows 8.1-Personal(64bit)
                            Access 2013(32bit)
                            First thing that happened is that there were multiple warnings about not having the Adobe Acrobat references set.
                            1) I don't have acrobat (or any adobe product) installed on this pc
                            2)Access 2013 has it's own PDF engine

                            I opened the library references (once I got past all the errors) and removed the selections for the Acrobat libraries (two of them marked as missing :) )

                            Your toolbar worked just fine afterward.

                            I suspect that the Adobe Acrobat object libraries may be interfering with the Access2013 native PDF support. This may explain the weird behavior you are seeing when you load the fake PDF.

                            Easy enough to check - deselect those references on your test PC.

                            This doesn't explain the weird behavior I saw at work; however, we have Acrobat installed on our PC's there.... BUT, I also do not have those libraries referenced in any of my databases so I don't think I've found a root cause.

                            You might want to try decompiling and then recompiling the database...
                            TheSmileyCoder > how to decompile an access application or how to do a full fresh compile.
                            Personally, I would decompile, uncheck the Acrobat libraries, and then recompile.

                            If that doesn't work it may be worth unchecking those references and then un-installing Acrobat and then RE-installing Acrobat just in case the libraries are damaged. At work, it seems that we're always behind the curve on updates and they have group policy that locks down which programs can run and which cannot - very aggravating. I'm wondering if the version being used has the issue.



                            -z
                            Last edited by zmbd; Apr 30 '16, 05:20 PM. Reason: [z: updated a thought here]

                            Comment

                            Working...