Difference between revisions of "Microsoft KB Archive/106181"

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 118: Line 118:
 
</div></li>
 
</div></li>
 
<li>Click the Debug button (or the OK button in versions 1.x and 2.0).</li>
 
<li>Click the Debug button (or the OK button in versions 1.x and 2.0).</li>
<li>The Module Design window will be opened to the PrintTest() function. Close the Module Design window by clicking Close on the File menu. When you receive the message &quot;Reset halted programs so Code window can be closed,&quot; click OK.</li>
+
<li>The Module Design window will be opened to the PrintTest() function. Close the Module Design window by clicking Close on the File menu. When you receive the message "Reset halted programs so Code window can be closed," click OK.</li>
 
<li>The Action Failed dialog will be in the foreground, referring to the macro action. Click the Halt button.</li></ol>
 
<li>The Action Failed dialog will be in the foreground, referring to the macro action. Click the Halt button.</li></ol>
  
Line 127: Line 127:
 
== REFERENCES ==
 
== REFERENCES ==
  
For more information about debugging Microsoft Access applications, search on &quot;debugging macros,&quot; and then either &quot;Find problems in a macro by single stepping through it&quot; or &quot;Using the Debug window&quot; using the Microsoft Access 7.0 Help Index.
+
For more information about debugging Microsoft Access applications, search on "debugging macros," and then either "Find problems in a macro by single stepping through it" or "Using the Debug window" using the Microsoft Access 7.0 Help Index.
  
 
</div>
 
</div>

Latest revision as of 09:59, 20 July 2020

Article ID: 106181

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
  • Microsoft Access 95 Standard Edition



This article was previously published under Q106181

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

SYMPTOMS

When you click Cancel to cancel printing started by a macro that contains a function with a DoCmd.PrintOut acPrintAll statement (or DoCmd Print A_Printall statement in Microsoft Access versions 1.x and 2.0), you may receive a series of alert messages.

STATUS

This behavior is by design. It allows you to trap and test for execution failure and cancellation as individual results.

MORE INFORMATION

Steps to Reproduce Behavior



  1. Create a new module and type the following code.

    In Microsoft Access for Windows 95 version 7.0:

            Option Explicit
    
            Function PrintTest()
             DoCmd.PrintOut acPRINTALL,,,True
            End Function
                            

    In Microsoft Access versions 1.x and 2.0:

            Option Explicit
    
            Function PrintTest()
               DoCmd Print A_PRINTALL,,,True
            End Function
                            
  2. Save the module as Print Test Module.
  3. Create the following new macro and save it as Print Test Macro:

           Macro Name          Action
           ---------------------------
           Print Test Macro    RunCode
    
           Print Test Macro Actions
           -----------------------------
           RunCode
              Function Name: PrintTest()
                            
  4. Create a new form and add a command button to the form. Set the command button's OnClick property to Print Test Macro.

    NOTE: In Microsoft Access version 1.x, the OnClick property is called the OnPush property.
  5. View the form in Form view. Click the Print Test Macro button.
  6. Once printing begins, click Cancel. Note that you receive the following message.

    In version 7.0:

    PrintOut Action Was Canceled

    In versions 1.x and 2.0:

    Action Print was canceled

  7. Click the Debug button (or the OK button in versions 1.x and 2.0).
  8. The Module Design window will be opened to the PrintTest() function. Close the Module Design window by clicking Close on the File menu. When you receive the message "Reset halted programs so Code window can be closed," click OK.
  9. The Action Failed dialog will be in the foreground, referring to the macro action. Click the Halt button.


REFERENCES

For more information about debugging Microsoft Access applications, search on "debugging macros," and then either "Find problems in a macro by single stepping through it" or "Using the Debug window" using the Microsoft Access 7.0 Help Index.

Keywords: kbprb kbprogramming KB106181