Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Crystal Reports Active X flashes an empty report in VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Crystal Reports Active X flashes an empty report in VFP
Divers
Thread ID:
00575003
Message ID:
00575003
Vues:
58
I have a VFP 6.0 form with a Crystal Report V8.0 ActiveX control. I choose a report name from a combobox and run the Crystal Report. The report allows me to enter the input parameters, but then after a few seconds it shows me a blank Crystal Report window that last for less than a second and disappears.

When I run that same Crystal Report stand-alone, it gives me a report. Any ideas as to what's wrong? If I uncomment out the command line for THISFORM.crpt.Action = 1, I get the error "Unable to open SQL server" or something like that. I am still looking at an example trying to understand what testout variable is for and what it does. I haven't been able to figure that one out either. Testout comes right after Action = 1 command line.

Here's the code contained in the VFP command button that runs the reports after they are selected from the combobox-
* Put date from combobox into MM/DD/YYYY format for date range on report.
*lcFromDate = THISFORM.cboFromMo.Value + "/" + ;
*		THISFORM.cboFromDay.Value + "/" + ;
*		THISFORM.cboFromYr.Value
*lcToDate = THISFORM.cboToMo.Value + "/" + ;
*		THISFORM.cboToDay.Value + "/" + ;
*		THISFORM.cboToYr.Value

* Convert Date from Date to Char type		
gcStartDate = CTOD(gcFromDate)
gcEndDate = CTOD(gcToDate)

* Convert Date from Date to Char type		
gcStartDate = CTOD(gcFromDate)
gcEndDate = CTOD(gcToDate)
IF EMPTY(gcTimeName)
	gcTimeName = ""
ENDIF
gcRptDate = gcTimeName + "(" + DTOC(gcStartDate) + " - " + DTOC(gcEndDate) + ")"
THISFORM.fromtodate() && Change date in From To Date pull-downs to match chosen date option

*** Run Reports ***

* Hospital Admissions
IF THISFORM.cborpt.Value = "16"
	THISFORM.HospAdmit()
ENDIF
* Medical Examiner
IF THISFORM.cborpt.Value = "20"
	THISFORM.MedExam()
ENDIF
* Monthly Top Shock
IF THISFORM.cborpt.Value = "60"
	THISFORM.crpt.ReportFileName = "c:\annulrpt\motopshock.rpt"
*	THISFORM.crpt.PrintFileName = "c:\annulrpt\motopshock.doc"
	THISFORM.crpt.ParameterFields(0) = "ReportYr;"+THISFORM.cboFromYr.Value
	THISFORM.crpt.ParameterFields(1) = "ReportMo;"+THISFORM.cboFromMo.Value
*	THISFORM.crpt.Action = 1
	testout = THISFORM.crpt.PrintReport
ENDIF

*!*	* Create the CR Object
*!*	loCR = CREATEOBJECT("CrystalRuntime.Application")

*!*	* Open the report
*!*	loCrRpt = loCr.OpenReport("C:\CR\MoTopShock.Rpt")

*!*	* Set the data location
*!*	loCRData = loCrRpt.Database
*!*	loCrTables = loCrData.Tables
*!*	loCrTables.Item(1).Location = "C:\CR\Customer.DBF"

*!*	* Set the export options
*!*	loExportOptions = loCrRpt.ExportOptions
*!*	loExportOptions.DestinationType = 1 && crEDTDiskFile
*!*	loExportOptions.FormatType = 29 && crEFTExcel80
*!*	loExportOptions.DiskFileName = "C:\CR\Export.XLS"

*!*	* Export the file
*!*	loCrRpt.DiscardSavedData()
*!*	loCrRpt.Export(.F.)

*!*	* Manual garbage collection
*!*	loExportOption = NULL
*!*	loCrTables = NULL
*!*	loCrData = NULL
*!*	loCrRpt = NULL
*!*	loCR = NULL

*!* ENDIF
* Quarterly Top Shock Award
IF THISFORM.cborpt.Value = "51"
*	THISFORM.MedExam()
ENDIF

THISFORM.LOCKSCREEN = .T.
THISFORM.Refresh
THISFORM.setbackcolor
THISFORM.LOCKSCREEN = .F.
THISFORM.cboRpt.SetFocus()
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform