[Migrated content. Thread originally posted on 03 February 2004]
I'm having a problem with the Crystal Reports RDC where, at times, my program will stop responding after previewing a report. It doesn't happen every time. I've tried it with Crystal Reports RDC versions 8.5, 9.0, and 10.0 and they all produce the same results. The program stops responding when I try to destroy the handle of the report object after previewing.Has anyone else encountered this problem and found a solution?
It works fine if I print rather than preview.
Any help is appreciated.
Thanks,
I've walked it through the debugger and after previewing the report when the DESTROY CRYSTAL-RPT command is executed, the program stops resonding.
Snippets of code follow....
77 CRYSTAL-APP HANDLE OF APPLICATION.
77 CRYSTAL-RPT HANDLE OF REPORT.
MAINLINE.
CREATE @Application OF @CRAXDRT HANDLE IN CRYSTAL-APP.
MOVE CR-PASS-RPT TO WS-FILE-NAME.
INSPECT WS-FILE-NAME REPLACING TRAILING SPACES BY NULLS.
MODIFY CRYSTAL-APP @OpenReport(WS-FILE-NAME) GIVING CRYSTAL-RPT.
MODIFY CRYSTAL-RPT @DiscardSavedData().
MODIFY CRYSTAL-RPT @ReadRecords().
IF CR-PRINT
PERFORM CRYSTAL-PRINT
ELSE
PERFORM CRYSTAL-PREVIEW
END-IF.
DESTROY CRYSTAL-RPT.
DESTROY CRYSTAL-APP.
MAINLINE-EXIT.
EXIT.
/
CRYSTAL-PRINT.
MODIFY CRYSTAL-RPT @PrinterSetup(0).
MODIFY CRYSTAL-RPT @PrintOut(1).
CRYSTAL-PRINT-EXIT.
EXIT.
/
CRYSTAL-PREVIEW.
COPY RESOURCE "CRV10.res".
CALL "C$RESOURCE" USING CRESOURCE-LOAD "CRV10.res" GIVING ActiveX-Res.
DISPLAY Independent WINDOW LINES 36.50 SIZE 53.50 CELL HEIGHT 10
AUTO-MINIMIZE CELL WIDTH 10 ACTION Action-Maximize COLOR IS 65793
CONTROL FONT Small-Font ERASE LABEL-OFFSET 0 MODELESS RESIZABLE NO SCROLL
WITH SYSTEM MENU TITLE PREVIEW-TITLE TITLE-BAR NO WRAP
HANDLE IS VIEWER-WINDOW.
DISPLAY CRV-SCREEN.
CALL "C$RESOURCE" USING CRESOURCE-DESTROY ActiveX-Res.
INQUIRE VIEWER-WINDOW LINES IN WS-LINES SIZE IN WS-SIZE.
MODIFY CR-VIEWER SIZE = WS-SIZE LINES = WS-LINES.
MODIFY CR-VIEWER @ReportSource = CRYSTAL-RPT.
MODIFY CR-VIEWER @ViewReport().
MOVE SPACES TO ACTION-CODE.
PERFORM SET-ARROW-POINTER.
PERFORM ACCEPT-CRV-SCREEN UNTIL ACTION-QUIT.
DESTROY VIEWER-WINDOW.
CRYSTAL-PREVIEW-EXIT.
EXIT.
/