No print menu or button available for reports?

A

AK

Hi.

I have an Access 2002 database that I "upgraded" to 2007 (in case that makes
a difference).

The 2002 version used a custom menu and had I had no problem accessing the
Print menu option.

The 2007 uses a custom ribbon (designed with FromScratch="true").

I open a report in Preview mode and I am not able to print it (ie: there is
no menu or button available to me). The QuickAccess Toolbar is not there
(even though I selected to allow full menus and display shortcut menus in the
database option settings).

I AM able to print the report if I do a CNTRL+P (and the print dialog box
appears).

Any solution out there to retrieve my PRINT button/menu or do I need to
create a new ribbon to allow for printing of a report from the print preview
window?

Thanks!
 
M

Mark Andrews

Did you leave the Ribbon name combo in Access Options blank?

I usually have a custom ribbon called "Home" and on every form I want that
ribbon I specify it in properties on the form. It then switches to built-in
ribbons such as the print preview when I preview reports. Also switches to
built-in ribbons when designing etc....

or you can go the custom "print preview" menu route as well.

everything will be ribbons (no retrieving Access 2002 toolbars) unless they
are popup menus.

HTH,
Mark
RPT Software
http://www.rptsoftware.com
 
A

AK

Thanks for the reply!

Brilliant and simple solution!

Can't believe I couldn't figure that one out... thanks a million!
AK
 
A

Albert D. Kallal

I don't have download, but here is a custiom ribbon I make for reports

This ribbon was biult this way so it works in both the full version of
ms-access and also the runtime. So this will allow you to run your applicaon
on computers that don't have the full version of ms-access.


You don't really have to write any code here, but just cut + paste what I
have below...

First, create a standard code module callsed basApi (or whatever you like).

Paste in the code here:

http://www.mvps.org/access/api/api0001.htm

The above is just code to give us the file open dialog. You never have to
read, nor look at that code (so, it is messy and long..but I never looked at
it and we don't care about reading it). Save the above module.

Ok, Now, lets write some custom code that be run when you press a button on
the ribbon. Create antoher code module. Call it basReports, or whatever.

Simply paste in the follwing code:

Option Compare Database
Option Explicit

Public Function MySend()

DoCmd.SendObject acSendReport, Screen.ActiveReport.Name, acFormatPDF

End Function


Public Function MyExport(strFormat As String)

Dim strFileType As String
Dim strFileFilter As String
Dim strFileName As String

Select Case strFormat

Case "RTF" ' word
strFileType = acFormatRTF
strFileFilter = "*.rtf"

Case "XLS" ' excel
strFileType = acFormatXLS
strFileFilter = "*.XLS"

Case "TXT" ' text
strFileType = acFormatTXT
strFileFilter = "*.txt"

Case "HTML"
strFileType = acFormatHTML
strFileFilter = "*.html"

Case Else
Exit Function

End Select

strFileName = SaveFileName(strFileType, strFileType, strFileFilter)

If strFileName <> "" Then
DoCmd.OutputTo acOutputReport, Screen.ActiveReport.Name, strFileType,
strFileName
End If

End Function

Public Function SaveFileName(strTitle As String, _
strFilterText As String, _
strFilter As String) As String

strFilter = ahtAddFilterItem(strFilter, strFilterText, strFilter)
SaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
DialogTitle:=strTitle, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)

End Function


There is 3 routines in the above. One gives a send as "pdf" email option,
and the other routines are simply a file dialog browse, and a some code to
export the report as our desired format.

Last but not least, here is our custrom ribbon that you specify for all
reports

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="MyReport" label="Report Print and View Options">

<group idMso="GroupPrintPreviewPrintAccess" />
<group idMso="GroupPageLayoutAccess" />
<group idMso="GroupZoom" />


<group id="ListCommands" label="Print">
<button idMso="FilePrintQuick" keytip="q" size="large"/>
<button idMso="PrintDialogAccess"
label="Print Dialog"
keytip="d" size="large"/>
</group>

<group id="ExportCmds" keytip="e" label="Data Export">
<button idMso="PublishToPdfOrEdoc" keytip="p" size="large"/>

<button id="ExportExcel" label="Excel"
imageMso="ExportExcel" size="large"
onAction="=MyExport('XLS')"/>

<button id="ExportWord" label="Word"
imageMso="ExportWord" size="large"
onAction="=MyExport('RTF')"/>

<button id="ExportTextFile" label="Text"
imageMso="ExportTextFile" size="large"
onAction="=MyExport('TXT')"/>

<button id="ExportHtml" label="HTML Document"
imageMso="ExportHtmlDocument" size="large"
onAction="=MyExport('TXT')"/>

<button id="CreateEmail" label="Email Report (PDF)"
imageMso="FileSendAsAttachment"
enabled="true" size="large"
onAction= "=MySend()"/>
</group>


<group idMso="GroupZoom"></group>

<group id="Exit" keytip="x" label="Exit">
<button idMso="PrintPreviewClose" keytip="c" size="large"/>
</group>

</tab>
</tabs>
</ribbon>
</customUI>

That is it. So, you don't have to write any code...just cut + paste the
above....and you have a ribbon with the export icons, but you ALSO will have
a email as PDF icon on your ribbon.
 
M

Mark Andrews

Very nice! Does the standard ribbon not work in the Access2007 runtime (I
haven't used the runtime yet, but will soon)?
 
A

Albert D. Kallal

Mark Andrews said:
Very nice! Does the standard ribbon not work in the Access2007 runtime (I
haven't used the runtime yet, but will soon)?

The ribbon is limited in the runtime. So, not all of the ribbon options
appear. In the runtime the word + excel + pdf options don't appear. And the
options to save or convert to pdf don't appear. And, the bonuses email as
pdf option does not appear in either version, but in this custom ribbon it
does.

So, my ribbon solves all of these problems. It also means your users will
not care nor need to have the full version of ms-access for these features.

I think this whole ribbon setup deal is BETTER then previous versions of
ms-access. And, this all works with the runtime version (so, we can
distribute to users without having purchased ms-access).

The pdf ability is built right in without any messy printer driver or
whatever stuff. So, with just a bit of ribbon and a very small amount of
access code we can expose these features.

I "could" avoid the windows api and use the new access built-in filedialog,
but it does NOT allow me to set the output filter (*.txt, *.pdf) so I used
the api code. If one is against using api code, then we could elonat that
code part also.

At the end of day, there is VERY little code that we have to write here to
get these features...
 
M

Mark Andrews

Thanks for the explanation. I'll have to adopt this method also.

Custom icons in ribbons, with graphics stored in the database?
How about doing a sample on that one, if you are bored.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top