Find Which Reports Are Not Set to Print to the Default Printer

Problem

You are about to distribute your application to other Access users. You want to ensure that all your reports are set to print to the default printer so that they will work with the users’ installations of Windows. How do you create a list of all your reports and show whether or not they have been saved with the default printer setting?

Solution

Building on the code examples in this chapter, you can investigate the UseDefaultPrinter property of each report to determine if it has the default printer selected. This solution uses this property, along with some simple ActiveX Data Objects (ADO) code, to get a list of reports in your database, to check the default printer setting, and to save the results to a table. This table feeds a report that you can print, rptReportPrinters. Once you have this list, you can set the output device for each report that has been set to print to a specific printer rather than to the Windows default printer.

Open and run frmShowReports from 05-08.MDB. Figure 5-8 shows the form once it’s done all its calculations. It will show the name of every report in your database, along with the default printer setting for each.

The frmShowReports example form

Figure 5-8. The frmShowReports example form

You can obtain a printout of this information by pressing the Print Analysis button, which prints the rptReportPrinters report ...

Get Access Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.