Which version of VFP are you using. If it's the usual VFP9, you can make use of the reportlistener "OnPreviewClose" method. The help on that has good example code.
Just watch out, in REPORTBEHAVIOR 90, SYS(2040) does not become "2".
I double checked that in VFP9 9.0.0.7423. I think it's be design, as VFP 9 report behavior is using a pagecage that exactly prints what preview showed and thus does not do a separate pass for actual printing. You might be able to configure this to force a separate pass, especially when you depend on it in expressions that you actually want to only be added when finally printing and not in preview. Anyway, it's an annoyance.
I do not know an answer, too. Sys(2040) seems not always work as expected.
We have 2 buttons in our software :
"Preview " = Preview report without invoice number or with a watermark
"Print and save" = With invoicenumber and printout or generate PDF and save data
You may also try foxypreviewer, AFAIK you can programmatically hide the print (and other) buttons
The solution that always works is a reportlisteners OnPreviewClose method and SYS(2040) works with SET REPORTBEHAVIOR 80 or in older VFP versions (up to 8). So there's a solution to any case.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.