Page 1 of 1

Activex control and Crystal Reports

Posted: Tue Jun 23, 2009 4:29 pm
by Gochito
Hi. sorry for my english.
I have several applications running with HMG, managing dbf and MySQL databases.
Now, I'm linking my apps with Crystal Reports using the Activex control, and it works very well, using this code:

In the main window design, I'm inserting the activex control with the next ID (it was hard find the correct ID):

DEFINE ACTIVEX CrystalControl
ROW 220
COL 10
WIDTH 0
HEIGHT 0
PROGID "Crystal.CrystalReport"
END ACTIVEX

In the button that trigs the report, the next properties are assigned:

PRINCIPAL.CrystalControl.Object:WindowTitle := "Reporte de Crystal"
PRINCIPAL.CrystalControl.Object:ReportFileName := "\Reportes\ArchivosCrystal\Archivo.rpt"
PRINCIPAL.CrystalControl.Object:WindowShowPrintSetupBtn := .t.
PRINCIPAL.CrystalControl.Object:PrintReport()

The last method call trigs the window of the report.

Now, the Crystal Activex Control have some properties very usefull to the personalization of the reports, because you can change the formulas and parameters in the report. This properties are managed like arrays, in the next form (this is the native Visual Basic language of the manual):

CrystalReport1.Formulas(0) = "COMISIÓN= {archivo.VENTAS} * .1"
CrystalReport1.Formulas(1) = "TOTAL= {archivo.VENTAS} + {archivo.COMISIÓN}"

Now, when I tryed to call the property in HMG, in running time,it broke the program and displayed an error saying that it couldn't find the property. Don't work calling the property as:

PRINCIPAL.CrystalControl.Object:Formulas(0) := "TITULO='TITULO DEL REPORTE'"

neither:

PRINCIPAL.CrystalControl.Object:Formulas[0] := "TITULO='TITULO DEL REPORTE'"

neither:

Aadd(PRINCIPAL.CrystalControl.Object:Formulas,"TITULO='TITULO DEL REPORTE'"

Somebody would help me?

Re: Activex control and Crystal Reports

Posted: Tue Jun 23, 2009 4:37 pm
by Rathinagiri
Hi,

Your post is moved to HMG General Help forum.

It is here.

Since this is a duplicate post, I am locking it.