Show custom ribbon on Print Preview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sandra Walsh
    New Member
    • Nov 2011
    • 62

    Show custom ribbon on Print Preview

    Hello -

    I am working in Access 2010.

    I am trying to show a custom ribbon when a report is opened in Print Preview mode.

    I have created a custom ribbon called Print and Send. This ribbon shows only 4 options. (see image)

    The report is opened from a Reports Dashboard that hides all the ribbons and windows using the following On Load event:
    Code:
    Private Sub Form_Load()
    'Hide the menus and Objects
    
    Dim i As Integer
    For i = 1 To CommandBars.Count
    CommandBars(i).Enabled = False
    Next i
    
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.ShowToolbar "Menu Bar", acToolbarNo
    DoCmd.SelectObject acTable, , True
    DoCmd.RunCommand acCmdWindowHide
    
    End Sub
    The Event to open the report is as follows:
    Code:
    Private Sub PipelineReportBtn_Click()
     DoCmd.OpenReport "r_PipelineReport", acViewPreview, , , acWindowNormal
     DoCmd.ShowToolbar "Print and Send", acToolbarYes
     
    End Sub
    When I open the report, I get the error saying that the database cannot find the Print and Send toolbar.

    In the Report Design, there are no options available in the dropdown for Ribbon Name, Toolbar or Menu bar. properties.

    In the Current Database Options window, there are no options available in the dropdown for Ribbon Name. Allow Full Menus and Allow Default Shortcut Menus options are both checked.

    I would appreciate any insight regarding how to make this custom menu accessible.

    Many thanks,
    Sandra
    [imgnothumb]http://bytes.com/attachments/attachment/6408d1338567069/ribbon.png[/imgnothumb]
    Attached Files
    Last edited by NeoPa; Jun 2 '12, 10:14 PM. Reason: Made pic viewable.
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Open your report in design view, and for the report properties, select the "Other" tab, and fill in the "Ribbon Name" property with the name of your custom ribbon. Then it should show itself when you print preview the report.

    I am unsure whether any of your existing code might prevent the ribbon from showing. Please report back your observations on the matter.

    Comment

    • Sandra Walsh
      New Member
      • Nov 2011
      • 62

      #3
      Hey there -

      I had tried that without success. The ribbon names do not show up in the dropdown options for that property. I tried typing in the name with no luck.

      PS- I rem'd out the following code for this test.
      Code:
      DoCmd.ShowToolbar "Print and Send", acToolbarYes

      Comment

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

        #4
        Try commenting out these two:
        Code:
        DoCmd.ShowToolbar "Ribbon", acToolbarNo
        DoCmd.ShowToolbar "Menu Bar", acToolbarNo
        EDIT:
        If the ribbon names are not showing up as a dropdown for the property it is because they are not created correctly. When you say you, you have created the ribbons, HOW exactly did you create them?

        Comment

        • Sandra Walsh
          New Member
          • Nov 2011
          • 62

          #5
          The lines you are asking me to commnet out are on the dashboard, not the report. I want to hide all the menus and ribbons for the user when they open the database.

          However, I want to give them access to some options on the Print Preview ribbon when they open a report (WITHOUT showing the FILE tab), hence the custom ribbon.

          I created the custom ribbon via Customize the Ribbon per the attached image.

          Thanks for helping me sort this out!
          Sandra

          Comment

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

            #6
            Yes, I realise they are on the dashboard.

            I haven't "dealt" with you before or on the forum, or at least not to such a degree that I have taken notice.
            Its a sad experience from online forums that if I give out 5 detailed instructions, only 3 of them are followed (and the user doesn't properly report back which of the 3 he/she followed. Therefore with new(er) members I usually take a slower approach with fewer test instructions per post.

            Now in your specific case, the reasons I wanted you to try commenting out the lines were to follow a certain debug process trying best as possible to ascertain what exactly your settings are, since I can't see your computer nor code.

            I missed your original attached image, therefore I didn't spot it right away. Your "ribbon" is not a ribbon, it is a tab in a ribbon.

            You will need to create a table to store ribbon xml and load it at startup, if you want to achieve your goal. I can try to find a few resources for you, if interested, but I would say it does require a certain degree of experience to implement.

            Comment

            Working...