How to Create an Interruptible Report in Microsoft FoxPro

Last reviewed: January 26, 1996
Article ID: Q89146
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b

To allow the user to interrupt generating a report, place a user-defined function (UDF) as a field object in the Detail band of the report.

For example, if you want to create a UDF to interrupt a report, place a field named STOP() on the Detail line of the report. Then create the following program named STOP.PRG in the same directory as your report:

   ** STOP.PRG
   SET TALK OFF

   IF CHRSAW()
      WAIT CLEAR
      IF LASTKEY()=13
         SET TYPEAHEAD to 0
         DEFINE WINDOW stopit FROM 10,10 TO 14,60 DOUBLE
         ACTIVATE WINDOW stopit
         x=0
         @ 1,5 SAY "Stop printing report" GET x ;
            PICTURE "@*H Yes ; No"
         READ
         IF x=1
            GO BOTTOM
         ENDIF
      ENDIF
      DEACTIVATE WINDOW stopit
   ENDIF

   SET TALK ON
   SET TYPEAHEAD TO 20
   RETURN ""

NOTE: SET TYPEAHEAD prevents FoxPro from referring to the ENTER key already in the keyboard buffer (the print action calls the Print dialog box with the PROMPT command).

The first time you run the code, you must press the ESC key to cancel printing. The second time, and every time therefter, if you press ENTER when the report is in process, a dialog box prompts you for the appropriate action.


Additional reference words: FoxDos 2.00 2.50 2.50a 2.50b cancel quit exit
stopping
KBCategory: kbprint kbprg kbcode
KBSubcategory: FxprintGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 26, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.