Set all reports to print to default printer

  • Thread starter Thread starter Mark Hammer
  • Start date Start date
M

Mark Hammer

Before shipping an updated version of my app, I'd like to insure that all
reports are set to print to the default printer.

Seems simple, but I'm missing something. Here's the code I tried:

=============
Dim rpt As Report

For Each rpt In Application.Reports
' open it in design view
DoCmd.OpenReport rpt.Name, acViewDesign, , , acHidden
If rpt.UseDefaultPrinter = False Then
Debug.Print rpt.Name, " Changed."
rpt.UseDefaultPrinter = True
DoCmd.Close acReport, rpt.Name, acSaveYes
Else
Debug.Print rpt.Name, " OK."
DoCmd.Close acReport, rpt.Name, acSaveNo
End If
DoEvents
Next rpt
=============

However, the "For Each rpt" feature seems not to work. The code never goes
into the "For Each . . . Next" loop, instead skipping to the code line
following "Next rpt".

Help appreciated!

Mark Hammer
Lake Oswego, Oregon, U.S.
 
Should have said I'm using Access 2002.

And I just realized that the Reports collection refers only to OPEN reports,
which explains why my code wasn't entering the loop.

Remaining problem is, how to iterate thru all the reports which are not
open?

--Mark Hammer
 
Back
Top