Automating Report Printing Trouble

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

I have a report that I set to print "On Open" (in the event tab of the
report properties dialog) with the following code:

Private Sub Report_Open(Cancel As Integer)
DoCmd.PrintOut acPrintAll, , , , 1, True
End Sub

The problem is: when I open the report it tries to run the code then gives
me this message:

Run-time error '2585':
This action can't be carried out while processing a form or report event.

I have also tried a VB Module:

Function test()
DoCmd.OpenReport "NewCatalog", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , 1, True
DoCmd.Close acReport, "NewCatalog"
End Function

This gave me the same error.

Any ideas?

Matthew
 
Try opening the report from a button on a form.
You can use the command button wizard to create a button which will print
your report.

HTH
- Turtle
 
Thanks for the response. I found the problem.

Whoever created the report set it to run a second macro "On Print" and
something was wrong with that macro.

Matthew
 
Back
Top