LOCAL loEventHandler LOCAL loCrystal AS CRAXDRT.Application LOCAL loReport AS CRAXDRT.Report LOCAL llSuccess * Instantiate the RDC loCrystal = CREATEOBJECT("CrystalRuntime.Application") * Get the report object loReport = loCrystal.OpenReport("C:\CR\Inventory.RPT") * Instantiate the event handler class loEventHandler = CREATEOBJECT("ReportEventHandler") * Bind the event handler to the events in the section llSuccess = EVENTHANDLER(loReport, loEventHandler) IF llSuccess * If the event binding was successful, print the report loReport.PrintOut(.F.) * Unbind the event handler EVENTHANDLER(loReport, loEventHandler, .T.) ENDIF * Define the event handler class DEFINE CLASS ReportEventHandler AS session OLEPUBLIC IMPLEMENTS IReportEvent IN ; "c:\program files\crystal decisions\report designer component\craxdrt9.dll" PROCEDURE IReportEvent_NoData(pCancel AS LOGICAL) AS VOID ; HELPSTRING "Fires this event when there is no data" * Write a message to the log STRTOFILE("No Data Event." + CHR(13) + CHR(10), "C:\CR\EventLog.TXT", .T.) ENDPROC PROCEDURE IReportEvent_BeforeFormatPage(PageNumber AS Number) AS VOID ; HELPSTRING "Fires this event before formatting a page" * Write a message to the log STRTOFILE("Before Format Page Event. Page No: " ; + TRANSFORM(PageNumber, "999") + CHR(13) + CHR(10), ; "C:\CR\EventLog.TXT", .T.) ENDPROC PROCEDURE IReportEvent_AfterFormatPage(PageNumber AS Number) AS VOID ; HELPSTRING "Fires this event after formatting a page" * Write a message to the log STRTOFILE("After Format Page Event. Page No: " ; + TRANSFORM(PageNumber, "999") + CHR(13) + CHR(10), "C:\CR\EventLog.TXT", .T.) ENDPROC PROCEDURE IReportEvent_FieldMapping(reportFieldArray AS VARIANT, ; databaseFieldArray AS VARIANT, useDefault AS LOGICAL) AS VOID ; HELPSTRING "Fires this event if database is changed while verifing database" * Write a message to the log STRTOFILE("Field Mapping Event.", "C:\CR\EventLog.TXT", .T.) ENDPROC ENDDEFINE>hi guys...