Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Report Using DoCmd

Status
Not open for further replies.

cmmd2003

Programmer
Mar 23, 2007
28
GB
Can anybody explain why this does not work

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


Im getting the error message

This action cannot be carried out while processing a form or report event.
 
What exactly are you trying to do? DoCmd.PrintOut is not used to print reports, it used to print "pages" of a form or datasheet, from within that form or datasheet.


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Well basically, from a switchboard, i want to print a report without having to open it, go to filed and then click print. Ideally i just want it to open and print on its own.
 
i just want it to open and print
DoCmd.OpenReport "YourReportName", acViewNormal

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Place the cursor inside the OpenReport word in your code and press the F1 key.
 
That doesnt help. From the switchboard, i want to click a button that will open the report, and the report prints automatically.

I tried using the code

DoCmd.PrintOut acPrintAll

In the On open event to no success.

Im getting the error message

This action cannot be carried out while processing a form or report event.

How can i make it work
 

cmmd2003,

Replace your code with the code given to you by PHV. Then, follow his instructions regarding the F1 key.


Randy
 
when i use his code i get the same error.
And f1 attempts to install some form of help that i dont have and it fails.
 

Try this...
Code:
DoCmd.OpenReport "YourReportName"

If it doesn't work, post your exact code.


Randy
 
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenReport "RptItem"
End Sub
 
PHV code should be placed on the on_click event for the command button on your switchboard.


ck1999
 
In form view, right click on the button.
Select properties.
When the properties box appears, select the events tab. Click in the box next to On Click and select Event Procedure.
Next, click on the elipses (3 dots) button to view and edit the code.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top