Page 1 of 1

Crystal Reports 9 (SOLVED)

Posted: Sun Sep 16, 2018 6:13 am
by ryugarai27
Hi Fivewin Experts,

I am using CR9 to display reports on my application, but now it is giving me an error:

Error occurred at: 09/16/18, 14:06:17
Error description: Error CrystalRuntime.Application.9/3 DISP_E_MEMBERNOTFOUND: OPENREPORT
Args:
[ 1] = C Test.rpt

Stack Calls
===========
Called from: => TOLEAUTO:OPENREPORT( 0 )
Called from: testcr9a.prg => MAIN( 10 )

The Crystal Report Application object was created but unable to find the function OpenReport, is there any other libraries I need to link or register? I have already registered the following dll:

regsvr32 craxdrt9.dll /s
regsvr32 crviewer9.dll /s
regsvr32 crqe.dll /s
regsvr32 crtslv.dll /s
regsvr32 ExportModeller.dll /s

Here is my test code:
#include "Fivewin.ch"

FUNCTION MAIN()

LOCAL oCrystal := CreateObject( "CrystalRuntime.Application.9" )
LOCAL oReport
LOCAL oWnd, oCRViewer

Msginfo( oCrystal )
oReport := oCrystal:OpenReport( "Test.rpt" )

DEFINE WINDOW oWnd

oCRViewer = TActiveX():New( oWnd, "CRViewer9.CRViewer" )
oCRViewer:SetProp( "ReportSource", oReport )
oCRViewer:Do( "ViewReport" )

oWnd:oClient = oCRViewer

ACTIVATE WINDOW oWnd;
MAXIMIZED

RETURN NIL

Thanks and best regards,
ryu

Re: Crystal Reports 9

Posted: Sun Sep 16, 2018 8:38 am
by dutch
Dear Ryu,

Do you try to enter full path of your report file? I use full path without problem.

I hope it may help.

Re: Crystal Reports 9

Posted: Sun Sep 16, 2018 11:26 am
by ryugarai27
Hi Dutch,

Thanks, I've also tried using absolute path like:

oReport := oCrystal:OpenReport( "D:\projects\fwh1706\testCR9\Test.Rpt" )

but still getting the same result. The program created the TOLEAUTO object because I can confirm using Msginfo( oCrystal:Classname()), I am just confused why it can't find the OpenReport method of the oCrystal object.

Best regards,
ryu

Re: Crystal Reports 9

Posted: Sun Sep 16, 2018 11:34 am
by dutch
Have you ever print CR9 successful?

Re: Crystal Reports 9

Posted: Sun Sep 16, 2018 11:55 am
by ryugarai27
Hi Dutch,

Yes, I have used it in the past using Windows 7 32 bit. Now, I am using 64 bit OS, I am not sure if the change of OS might be the problem. I hope it is not.

Best regards,
ryu

Re: Crystal Reports 9

Posted: Sun Sep 16, 2018 12:39 pm
by dutch
Dear Ryu,

I used CR XI R2 with W10 32bits but when I change OS to W10 64bits, it doesn't work. I have to change viewer to CR XI R2 SP6 to support 64bits. I recommend to use CR XI R2 SP6 viewer.
ryugarai27 wrote:Hi Dutch,

Yes, I have used it in the past using Windows 7 32 bit. Now, I am using 64 bit OS, I am not sure if the change of OS might be the problem. I hope it is not.

Best regards,
ryu

Code: Select all

   TRY
    oCrystal:= CreateObject("CrystalRuntime.Application.11")    // Declare CreateObject
   CATCH oError
    lStart := .F.
    MsgAlert( oError:Description )
   END
   
   if lStart
    
       TRY
           oRpt    := oCrystal:OpenReport(cReport)          // Open Report
       CATCH oError
        lStart := .F.
        MsgAlert( oError:Description )
       END
    end 
        if lStart   
                   DEFINE WINDOW oWnd FROM 3, 6 TO 20, 70 TITLE "Print and Preview"

                        oCRViewer := TActiveX():New( oWnd, "CrystalReports.ActiveXReportViewer" )  
                        oWnd:oClient := oCRViewer
                    
                        oCRViewer:ViewReport()
                   ACTIVATE WINDOW oWnd MAXIMIZED
        end
 

Re: Crystal Reports 9 (SOLVED)

Posted: Mon Sep 17, 2018 6:39 am
by ryugarai27
Hi Dutch,

Reinstalling CR9 solved the problem, thanks for your help anyway. Will try CRXI in the future.

Best regards,
ryu