>Hi,
>
>I've encountered a problem in trying to print a report from within a form. I've done this a million times and can't understand what would cause this problem.
>
>The command is: Report Form Errrept Preview
>
>Simple, huh? It executes just fine from the Command Window. It's counterpart to this routine (Report Form Errrept to Printer NoConsole) executes perfectly.
>
>I believe it has something to do with the form properties. The properties that could affect this situation are: Alwaysontop = .T. (Which I set to .F. before executing the Report Form instruction), and ShowWindow as Top Level Form . I believe it has to do with the ShowWindow property, however, if I don't leave it as a Top Level Form, when my form is called, it appears behind the calling form. How can I get around this without altering the ShowWindow property (if that is in fact my problem)?
>
>Any assistance would be greatly appreciated.
>
>TIA
>
Hi Barry,
As Jim mentioned unless you provide a window (form) for the preview, it won't work because the default is in _SCREEN and it's not visible with this.
What I did was to subclass a form for this purpose, setting it as a top-level form. Then to print the report:
SET CLASSLIB TO SDIClass ADDITIVE
oPreviewFrm = CREATEOBJECT("PreviewForm")
RELEASE CLASSLIB SDIClass
REPORT FORM (report file) ENVIRONMENT NOCONSOLE PREVIEW IN WINDOW (oPreviewFrm.Name)
hth,
George
Ubi caritas et amor, deus ibi est