Wayne,
A quick excerpt from "The Visual FoxPro© Report Writer: Pushing it to the Limit and Beyond" By Cathy Pountney - available at
While it's not exactly what you asked for, you should be able to adapt the idea.
"How do I know if the user canceled?
Often, you need to update some type of printed flag in the data or do some special processing once the user has printed a particular report. To accomplish this, you need to make sure the user really did print the report. You wouldn’t want to update the flag if the user only previewed the report. In addition, you need to make sure the user didn’t cancel the report before it finished.
To solve this problem, use the following code to call the report.
Code:
*-- Initialize variable
PRIVATE plPrinted
plPrinted = .f.
*-- Print the report
REPORT FORM MyReport NOCONSOLE TO PRINTER PROMPT PREVIEW
*-- Check to see if the user printed
IF plPrinted
* Do your update code here
ENDIF
*-- Get out
RETURN
*----------------
FUNCTION Rpt_Done
*----------------
*-- Set the printed flag
IF WEXIST("Printing...")
plPrinted = .t.
ENDIF
As the final step, use the following expression in the On Exit portion of the Summary band.
Rpt_Done()
Because the Summary band is the last thing processed by the Report Writer, calling the UDF in the On Exit section of the Summary band ensures the plPrinted flag isn’t set until the entire report has finished. Of course, you can’t be sure it physically printed, but that’s out of your control.
In FoxPro 2.x, the name of the Preview window is “Page Preview” instead of “Printing…”."
Rick