10.2. Printing, Previewing, and Exporting a Report
Once you've created the perfect report, it's time to share it with rest of the world. Most commonly, you'll choose to print it.
Printing a report is easysimply choose Office button Print. But before you inadvertently fire off an 87-page customer list in jumbo 24-point font, its a good idea to preview the end result. Access makes it easy with its integrated Print Preview feature.
Tip: You don't need to open your report to print it. Just select it in the navigation pane, and then choose Print from the Office menu. But bewarewhen you use this shortcut you don't get the chance to preview the result and make sure it's what you want before it pops out of the printer.
10.2.1. Previewing a Report
To get a preview of what your printed report will look like, right-click the report tab title and then choose Print Preview, or choose Office button Print Print Preview. Print Preview mode doesnt let you make any changes or select any part of the report. You're limited to zooming in and out, and moving from page to page (see Figure 10-11). When you're finished looking at your print preview, choose Print Preview Close Preview Close Print Preview.
In Print Preview mode, the ribbon changes dramatically. The tabs you've grown to know and love disappear, and Access replaces them with a single tab named Print Preview. (This is the same Print Preview tab you saw when you previewed a datasheet printout in Chapter 3.) You can use all the same techniques that you learned in Section 184.108.40.206 to move around the preview, see multiple pages at once (which lets you study where page breaks occur), and change the page margins and paper orientation.
For example, the Portrait and Landscape buttons let you quickly switch between the standard portrait orientation (which places the short edge at the top of the page) and landscape (which rotates the page, placing the long edge at the top). Portrait fits more rows, while landscape fits more columns. Generally, portrait is best, provided it can fit all your columns. If portrait mode doesn't fit all your columns , you can try using landscape orientation, a smaller font size (Section 10.3.1), narrower margins, or a larger type of paper.
| || |
Figure 10-11. To zoom in, click once with the mouse. Click again to zoom back out to the full page view. You can also use the page navigation buttons at the bottom of the window to move from one page to the next , and the zoom slider (not shown) for more precise zooming. But the most useful commands appear in the ribbon, which lets you tweak the print settings and export your report results to another type of file.
Note: Reports always use your standard paper size (which is usually 8.5 x 11 inches, or letter size) when you first create them. However, if you change the size, the new size setting is stored with the report. That means the next time you open your report, it still has the customized paper size. The same applies for the paper orientation setting.
Access has two extra options that aren't provided in a normal datasheet print preview:
Use the Print Data Only button to produce a streamlined printout that leaves out details like column headers and titles. This option is rarely useful, because the resulting printout is harder to read.
Use the Columns button to fit more report data on a page. This option works only if your report is much narrower than the page width. For example, if your report is less than half the width of the page, you can double-up by using two columns. You'll need half the number of pages. in Section 11.3, you'll see how the Label wizard uses a multicolumn report to pack mailing labels on a page.
Tip: You can change a lot of the page layout settings (like margins and paper orientation) without heading to the print preview. You'll find many of the same buttons in the Report Layout Tools Page Setup tab of the ribbon, which appears whenever you have your ribbon in Layout view.
10.2.2. Exporting a Report
The Print Preview tab is a bit of an oddity, because it includes a few commands that don't have anything to with printing your report. The commands in the Print Preview Data section let you take a snapshot of the current report data, and then export it into some other type of file so you can view it outside of Access or work with it in another program. This technique is a great one to use if you want to share some data with other people (read: impress the boss).
Although Access supports many different formats for exporting a report, you'll use just a few with reports. (The others are more useful when you're exporting pure data from a table or query, as explained in Chapter 19.) The useful formats for exporting reports include:
Word . This option transforms your report into a document you can open in Microsoft Word. However, the format Access uses is a bit clumsy. (It separates each column with tabs and each line with a hard return, which makes it difficult to rearrange the data after the fact in Word.) A nicer export feature would put the report data into a Word table, which would make it far easier to work with.
HTML Document . This option transforms your report into a rich HTML document, suitable for posting on the Web or just opening straight from your hard drive. The advantage of this format is that all you need to view it is a Web browser (and who doesn't have one of those?). The only drawback is that the formatting, layout, and pagination of your report won't be preserved exactly, which is a disadvantage if someone wants to print the exported report.
Snapshot Viewer . This option creates a .snp snapshot file, which anyone can open to view and print the fully formatted report. In order to view the snap-shot file, you need Microsoft's free Snapshot Viewer program. (To download it, surf to http://office.microsoft.com and search for "Snapshot Viewer.") Although the Snapshot Viewer works perfectly well, most people prefer to use the more standard PDF format (next in the list), which provides the same features. (Truthfully, the Snapshot Viewer is a bit of a holdover from earlier versions of Office.)
PDF or XPS . This option lets you preserve your exact report formatting (so your report can be printed), and it lets people who don't have Access (and possibly don't even have Windows) view your report. The only disadvantage is that this feature isn't included in the basic Access package. Instead, you need to install a free add-in to get it (you'll see how in Section 10.2.3). For more information about the PDF and XPS formats, see the box "Learning to Love PDFs" below.
| UP TO SPEED |
Learning to Love PDFs
You've probably heard about PDF, Adobe's popular format for sharing formatted, print-ready documents. PDFs are used to pass around product manuals, brochures , and all sorts of electronic documents. Unlike a document format such as .xlsx, PDF files are designed to be viewed and printed, but not edited.
The best part about PDFs is that they can be viewed on just about any type of computer and operating system using the free Adobe Reader. You can download Adobe Reader at www.adobe.com/products/acrobat/readstep2.html, but you probably don't need to. Most computers already have Adobe Reader installed, because it comes bundled with so many different programs (usually so you can view their electronic documentation). It's also used widely on the Web.
PDF isn't the only kid on the block. Microsoft's newest operating system, Windows Vista, includes its own electronic paper format called XPS (XML Paper Specification). In time, as XPS is integrated into more and more products, it may become a true PDF competitor. But for now, PDF is dramatically more popular and widespread, so it's the one to stick with.
No matter which format you use, the process is essentially the same:
If you're not already in Print Preview mode, right-click the report tab title, and then choose Print Preview .
Choose a name for the destination file (Figure 10-12) .
The destination file is the place where the exported data will be stored.
If you wish to open your exported file in the related program, check the setting "Open the destination file after the export operation is complete."
Say you're exporting a Word document and you choose this option; Access will export the data, launch Word, and load up the document. This is a good way to make sure your export operation worked as expected. This option works only if you have the program you need on your computer.
Click OK to perform the export .
Ignore the other two checkboxes, which are grayed out. They apply only to export operations that work with other database objects.
| || |
Figure 10-12. Access assumes you want a name that matches your report (for example, ProductCatalog.rtf if the ProductCatalog report is exported to a rich text document that can be opened in Word). However, you can change the file name to whatever you want.
Note: Remember, exporting a report is like printing a report. Your exported file contains the data that existed at that moment in time. If you decide a week later that you need more recent data, you need to export your report again.
Choose whether or not you want to save your export settings .
By saving your export settings, you can quickly repeat your export operation later on. For example, if you export to a Word document and save the export settings, you can export the report data tomorrow, next week, or a year in the future. This feature is described in Section 19.3.7 in Chapter 19, which tackles export operations in more detail.
Tip: You don't need to open your report in order to export it. Instead, you can use all the commands you need straight from the navigation pane. Just right-click the report name, and then choose Export to show a menu of all your export options, from PDF files to HTML pages. You'll also see a few options that don't appear in the Export tab of the ribbon, including options for exporting the report to older, almost forgot -ten database and spreadsheet products like dBase, Paradox, and Lotus 1-2-3.
10.2.3. Getting the "Save As PDF" Add-in
To export a report as a PDF file, you need the "Save As PDF or XPS" add-in. To get it, surf to www.microsoft.com/downloads, and search for "PDF". The links will lead you to a page where you can download the add-in and install it with just a couple clicks.
Once you install the add-in, all your Office applications will have the ability to export their documents in PDF format. In an Access report, you work this magic by choosing Print Preview Data PDF or XPS while youve got a report in Print Preview mode. Or, you can right-click your report in the navigation pane, and then choose Export PDF or XPS.
When you export a PDF file, you get a few extra options in the "Publish as PDF or XPS" dialog box (Figure 10-13). PDF files can be exported with different resolution and quality settings (which mostly affect reports that have pictures). Normally, you use higher-quality settings if you're planning to print your PDF file because printers use higher resolutions than computer monitors .
| || |
Figure 10-13. The "Publish as PDF or XPS" dialog box looks a lot like the Export As dialog box, except it has a Publish button instead of an Export button. You can turn on the "Open file after publishing" checkbox to tell Access to open the PDF file in Adobe Reader ( assuming you have it installed) after the publishing process is complete, so you can check the result.
The "Publish as PDF or XPS" dialog box gives you some control over the quality settings with the "Optimize for" options. If you're just exporting a PDF copy so other people can view the information in your report, choose "Minimum size (publishing online)" to save some space. On the other hand, if there's a possibility that the people reading your PDF may want to print it out, choose "Standard (publishing online and printing)" instead. You'll export a slightly larger PDF file that will make for a better printout.
Finally, if you want to publish only a portion of your report as a PDF file, click the Options button to open a dialog box with yet a few more settings. You can choose to publish just a fixed number of pages rather than the full report.
Tip: Getting the "Save As PDF or XPS" add-in is a bit of a hassle, but it's well worth the effort. In previous versions of Access, people who wanted to create PDF files had to get another add-in or buy the expensive full version of the Adobe Acrobat software. The "Save As PDF or XPS" feature was originally slated for inclusion in Office (with no add-in required), but antitrust concerns caused an ultra -cautious Microsoft to keep it out. Best of all, the add-in gives you PDF-saving abilities in other Office applications, like Word, Excel, and PowerPoint.
| FREQUENTLY ASKED QUESTION |
Different Ways to Export Data
Is it better to export the results of a report, or the entire contents of a table?
There are several ways to transport data out of Access. You can take data directly from a table, or you can export the results of a query or a report. So which approach is best?
Generally, the easiest option is to get data straight from the appropriate table (as described in Chapter 19). However, in a few cases it makes more sense to use a report:
You want to use the unique arrangement of columns that you've defined in a report. (For example, you may not want the full Products tableinstead, the ProductCatalog report lays out exactly what you need.)
You want to use the filtering, sorting, or grouping settings that you've applied to a report. (You'll learn about these features in Chapter 11.)
You want to take advantage of the formatting you've applied to a report. Depending on what exporting option you use, you may be able to keep formatting details like fonts. If you export to a PDF file, HTML document, or snapshot, all the formatting remains in place. If you export to an Office application like Word or Excel, only some of the formatting is retained. But if you export a table or a query, you get the data only, and it's up to you to make it look nice all over again.
In Chapter 19, you'll take a closer look at how to export tables and queries.