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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancelling the printing launchs report in Pirnt Preview

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i have a form with a button for printing to the printer the content put in a report. If i cancel the printing configuration window, it opens the report in print preview, and is in forefront after closing the form.

Can this behaviour be avoided?

Thanks for any help given.
 
What would you like it to do?

Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
I would need that the report didn't open when i cancel the window. Though if instead of cancelling the printing configuration window i pressed Ok the report neither must be shown, only printed in the printer. So the report never must be opened.

Thanks.
 
I would imagine there must be something in the 'on open' or 'on load' events of either the print configuration window or the report. Check it out.

If you create a button using the wizard to print a report it will not display the report when printing.
~Here is the code it creates
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String

stDocName = "end of year"
DoCmd.OpenReport stDocName, acNormal

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub


If you wish to cancel printing (before you press the print button) create a button to just close the print configuration window.
Here is the code the wizard creates to close the form.

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click


DoCmd.Close

Exit_Command1_Click:
Exit Sub

Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click

End Sub


Hope this helps


Ian Mayor (UK)
Program Error
9 times out of 10 I know what I'm talking about. This must be my tenth reply.
 
Thanks ProgramError.

I have solved it handling the error 2501, which is the error produced when cancelling the printing configuration window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top