Microsoft KB Archive/263120

= ACC2000: PrintOut Action or Method Fails in MDE and ADE Files =

Article ID: 263120

Article Last Modified on 7/14/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q263120



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you run the PrintOut action or method to print an object in an MDE or ADE file, you may receive the following error message:

The expression On Click you entered as the event property setting produced the following error:

The command or action 'PrintOut' isn't available now.



CAUSE
This error occurs when you use the PrintOut action in a macro or DoCmd.PrintOut in a module to print a closed object in an MDE or ADE file.



RESOLUTION
Depending on what you are trying to accomplish, there are two possible resolutions.

If you just need to print the entire report, use the OpenReport action instead of the PrintOut action. For example, the following steps demonstrate how to use the OpenReport action to print the entire report.  Open the sample database Northwind.mdb. Open a new blank form in Design view. Add a command button to the form.  Set the OnClick property of the command button to the following event procedure: Private Sub Command0_Click DoCmd.OpenReport &quot;Alphabetical List of Products&quot;, acViewNormal End Sub  Save the form, and then close it. Open the form in Form view.</li> Click the command button. Note that Microsoft Access prints the Alphabetical List of Products report.</li> Close the form.</li> On the Tools menu, point to Database Utilities, and then click Make MDE File.</li> Type Northwind.mde for the file name, select the path where you want Microsoft Access to create the file, and then click Save.</li> Close the database.</li> Open the Northwind.mde file.</li> Open the form that you created earlier.</li> Click the command button.</li></ol>

Note that Microsoft Access prints the Alphabetical List of Products report.

However, if you need to specify such features as page range, print quality, and the number of copies to print, you must use the PrintOut action because the OpenReport action does not allow you to specify these features. If you need to take advantage of these features, use the following steps to work around the problem. <ol> Open the sample database Northwind.mdb.</li> Open a new blank form in Design view.</li> Add a command button to the form.</li>  Set the OnClick property of the command button to the following event procedure: Private Sub Command0_Click Application.Echo False DoCmd.OpenReport &quot;Alphabetical List of Products&quot;, acViewPreview DoCmd.SelectObject acReport, &quot;Alphabetical List of Products&quot;, False DoCmd.PrintOut acPages, 1, 1,, 2 DoCmd.Close acReport, &quot;Alphabetical List of Products&quot;, acSaveNo Application.Echo True End Sub </li> Save the form, and then close it.</li> Open the form in Form view.</li> Click the command button. Note that Microsoft Access prints the Alphabetical List of Products report.</li> <li>Close the form.</li> <li>On the Tools menu, point to Database Utilities, and then click Make MDE File.</li> <li>Type Northwind.mde for the file name, select the path where you want Microsoft Access to create the file, and then click Save.</li> <li>Close the database.</li> <li>Open the Northwind.mde file.</li> <li>Open the form that you created earlier.</li> <li>Click the command button.</li></ol>

Note that Microsoft Access prints two copies of the first page of the Alphabetical List of Products report.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
<ol> <li>Open the sample database Northwind.mdb.</li> <li>Open a new blank form in Design view.</li> <li>Add a command button to the form.</li> <li> Set the OnClick property of the command button to the following event procedure: Private Sub Command0_Click DoCmd.SelectObject acReport, &quot;Alphabetical List Of Products&quot;, True DoCmd.PrintOut End Sub </li> <li>Save the form, and then close it.</li> <li>Open the form in Form view.</li> <li>Click the command button. Note that Microsoft Access prints the Alphabetical List of Products report.</li> <li>Close the form.</li> <li>On the Tools menu, point to Database Utilities, and then click Make MDE File.</li> <li>Type Northwind.mde for the file name, select the path where you want Microsoft Access to create the file, and then click Save.</li> <li>Close the database.</li> <li>Open the Northwind.mde file.</li> <li>Open the form that you created earlier.</li> <li>Click the command button.</li></ol>

Note that you receive the error message mentioned in the &quot;Symptoms&quot; section of this article.

Additional query words: pra print out The command or action PrintOut isn t available now

Keywords: kberrmsg kbbug KB263120

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.