Activex control and Crystal Reports

New members who wish to post and participate in HMG Forum, please introduce yourselves in this forum by starting a new thread.

Moderator: Rathinagiri

Locked
User avatar
Gochito
Posts: 7
Joined: Tue Jun 23, 2009 3:36 pm

Activex control and Crystal Reports

Post by Gochito » Tue Jun 23, 2009 4:29 pm

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?

User avatar
Rathinagiri
Posts: 5181
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 141 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Jun 23, 2009 4:37 pm

Hi,

Your post is moved to HMG General Help forum.

It is here.

Since this is a duplicate post, I am locking it.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

Locked