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.
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.