[AccessD] Show the print preview ribbon

Dan Waters df.waters at comcast.net
Sat Mar 1 10:15:36 CST 2014


Hi Rocky,

This is what I've been doing since Access 2007 was released.  

Whenever I open a report my code looks like this:

        '------------------------------------
        DoCmd.OpenReport "rptReportName", acViewPreview
        DoCmd.Maximize    ' -- This maximizes the entire access window,
every time, so the report is readable.
                                            '      It also turned out that I
needed to maximize here instead of in the Report_Open event,
                                            '      but I don't remember
exactly why.
        '------------------------------------

In code on every report I have these two procedures:

        '------------------------------------
        Private Sub Report_Open(Cancel As Integer)

            Call DisplayRibbon(True)  '-- See Below

        End Sub

        Private Sub Report_Close()

            Call DisplayRibbon(False)    '-- See Below
            DoCmd.Restore    '-- This restores the entire access screen.

        End Sub
        '------------------------------------

This is the procedure which shows or hides the ribbon.  It is in a public
module.

        '------------------------------------
        Public Sub DisplayRibbon(blnDisplayRibbon As Boolean)

            If SysCmd(acSysCmdAccessVer) >= 12 Then  '-- Of course, ribbons
only exist in Access 2007+

                If blnDisplayRibbon = True Then
                    DoCmd.ShowToolbar "Ribbon", acToolbarYes    '-- When the
report opens, print preview is the ribbon which is automatically displayed.
                Else
                    DoCmd.ShowToolbar "Ribbon", acToolbarNo
                End If

            End If

        End Sub
        '------------------------------------

Hope this helps!
Dan


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Saturday, 1 March 2014 10:23 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Show the print preview ribbon

Dear List:
 
In an mdb I have a custom toolbar for print previews which had just the
close button and the magnifying glass.  In 2003 this works well but in 2007,
10 and 13 the custom toolbar does not show up.  Not surprising.
 
But in 2010 - my client's version - there is a print preview button at the
top when you're in print preview, and when you click it, the print preview
ribbon is displayed with the CLOSE in red.  Very good.  
 
But the client does not want to click Print Preview to open the ribbon.  He
wants the ribbon displayed when the report opens in print preview.  
 
How is this done?
 
MTIA
 
Rocky
 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list