How to Create an Interruptible Report in Microsoft FoxPro

ID: Q89146

2.00 2.50 2.50a 2.50b MS-DOS kbprint

The information in this article applies to:

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 KBSubcategory: FxprintGeneral

Keywords          : kbcode FxprintGeneral 
Version           : 2.00 2.50 2.50a 2.50b
Platform          : MS-DOS

Last Reviewed: May 22, 1998