Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Report gives C-5 errors
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Report gives C-5 errors
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01478438
Message ID:
01478438
Views:
95
Hi Gang!

I added some code to the PRINT button of a report.

Now it goes BOOM !!! C-5 errors when you go in and run it about 2 - 3 times in a row... the 2nd or 3rd time gives the C-5 error. It acts like it gets slower when it gets to the

REPORT FORM xunpdrx2 PREVIEW WINDOW wReport

command.

The code runs fine until it executes this command. The first time it is fast... the 2nd time slower... the 3rd time even slower... then 4th... booom... crash.

Any ideas from the code below that executes it (this is from the cmdPRINT button on the form.

When the report runs, POSCONFG.RX1 is .T. and m.Choice_2 = 2 .
LOCAL lcTheFilter 
PRIVATE lcDateRange, lnCount

lcTheFilter = ''
lcDateRange = ''
lnCount = 0

*TMT 01/11/10 Added .T. to parameters... this is wheter to allow Export or not to SELPRINT.prg
*The reports that don't allow a choice will have .F. by default, since they won't pass it over to SELPRINT
*m.Choice_2 = SELPRINT(mOnLine, .T.)
m.Choice_2 = SELPRINT(mOnLine, .T.)

IF m.Choice_2 = 0
	Thisform.release
	RETURN
ENDIF

STORE "Searching for UnPaid Rx's for this date range..." TO Thisform.txtStatus.Value  
Thisform.refresh

****************************************************************
DO CASE 
	CASE EMPTY(Tmp_SDate) AND EMPTY(Tmp_EDate)
		lcTheFilter = " EMPTY(PU_DATE) "
		lcDateRange = '(All Rxs)'
	CASE NOT EMPTY(Tmp_SDate) AND EMPTY(Tmp_EDate)
		lcTheFilter = " (Tmp_Sdate <= date_fill) AND EMPTY(PU_DATE) "
		lcDateRange = 'All Rxs filled on or after ' + ALLTRIM(DTOC(Tmp_SDate))
	CASE EMPTY(Tmp_SDate) AND NOT EMPTY(Tmp_EDate)
		lcTheFilter = " (date_fill <= Tmp_Edate) AND EMPTY(PU_DATE) "
		lcDateRange = 'All Rxs filled on or before' + ALLTRIM(DTOC(Tmp_EDate))
	OTHERWISE 
		lcTheFilter = " (Tmp_Sdate <= date_fill) AND (date_fill <= Tmp_Edate) AND EMPTY(PU_DATE) "
		lcDateRange = 'All Rxs filled on or after ' + ALLTRIM(DTOC(Tmp_SDate)) + ' and on or before ' + ALLTRIM(DTOC(Tmp_EDate))
ENDCASE 
****************************************************************

SELECT UnPdRx
SET ORDER TO TAG NAME
SET FILTER TO &lcTheFilter
GO TOP
COUNT TO lnCount

*TMT 08/25/10 check to see if we have any to print....
IF _tally = 0
	IF mOnLine
		MESSAGEBOX("No UnPaid Rx Items found for this date range...",0+48,"UnPaid Rx List",10000)
	ENDIF 
	CloseBrow = .F.
	SELECT unpdrx
	SET FILTER TO
	GO TOP  
	THISFORM.Release
	SELECT RegTrans
	RETURN 
ENDIF 

IF NOT POSCONFG.RX1
	SELECT 0
	USE \PHARMACY\TABLES\PATIENT_MASTER
	SET ORDER TO TAG PATIENT_ID
	SET RELATION TO UNPDRX.PTNT_NO INTO PATIENT_MASTER IN UNPDRX
ENDIF

SELECT unpdrx
GO top

*TMT 01/11/10 Added Export to output
DO CASE 
	CASE m.Choice_2 = 1
		IF posconfg.rx1
			REPORT FORM xunpdrx2 NOCONSOLE TO PRINTER 
		ELSE
			REPORT FORM xunpdrx  NOCONSOLE TO PRINTER
		ENDIF	
	CASE m.Choice_2 = 2
		DEFINE WINDOW wReport FROM 0,0 to 100,200 TITLE "Report Preview" SYSTEM CLOSE
		ACTIVATE WINDOW wReport
		ZOOM WINDOW wReport MAX
		IF posconfg.rx1
			REPORT FORM xunpdrx2 PREVIEW WINDOW wReport
		ELSE
			REPORT FORM xunpdrx PREVIEW WINDOW wReport
		ENDIF
		RELEASE WINDOW wreport
	CASE m.Choice_2 = 3
		*TMN 08/03/2010
		IF NOT posconfg.rx1
			SELECT UNPDRX.DATE_FILL, UNPDRX.RX_NUMBER, UNPDRX.REFILL_NO, UNPDRX.UPC_CODE, ;   
					UNPDRX.DRUG_NAME, UNPDRX.QUAN_FILL, UNPDRX.PTNT_NO, UNPDRX.PTNT_NAME, ;
					UNPDRX.AREA_CODE, UNPDRX.ACCTNO, UNPDRX.NET, UNPDRX.AMOUNT, UNPDRX.PU_DATE, ;    
					UNPDRX.CHARGED, UNPDRX.SELECTED, UNPDRX.PAT_TYPE, UNPDRX.SELECT, ;
					UNPDRX.NH, UNPDRX.RX_TAX, UNPDRX.CUST_NO, UNPDRX.PLAN_ID, patient_master.home_phone ;  
					FROM unpdrx, patient_master ;
					WHERE EMPTY(unpdrx.pu_date) ;
					AND unpdrx.ptnt_no = patient_master.patient_id ;
					INTO CURSOR unpdrxcl readwrite
				 
			lcExportFile = PUTFILE("Export To","c:\UnPaid_Rx_List","XLS")
			IF !EMPTY(lcExportFile)
				SELECT unpdrxcl
				EXPORT TO (lcExportFile) TYPE XLS
			ENDIF

		*!*			IF !EMPTY(lcExportFile)
		*!*				SELECT unpdrx
		*!*				EXPORT TO (lcExportFile) TYPE XLS
		*!*			ENDIF
		ENDIF
		*TMN 08/03/2010
		
	CASE m.Choice_2 = 4
		*TMN 08/03/2010
		IF NOT posconfg.rx1
			SELECT UNPDRX.DATE_FILL, UNPDRX.RX_NUMBER, UNPDRX.REFILL_NO, UNPDRX.UPC_CODE, ;   
					UNPDRX.DRUG_NAME, UNPDRX.QUAN_FILL, UNPDRX.PTNT_NO, UNPDRX.PTNT_NAME, ;
					UNPDRX.AREA_CODE, UNPDRX.ACCTNO, UNPDRX.NET, UNPDRX.AMOUNT, UNPDRX.PU_DATE, ;    
					UNPDRX.CHARGED, UNPDRX.SELECTED, UNPDRX.PAT_TYPE, UNPDRX.SELECT, ;
					UNPDRX.NH, UNPDRX.RX_TAX, UNPDRX.CUST_NO, UNPDRX.PLAN_ID, patient_master.home_phone ;  
					FROM unpdrx, patient_master ;
					WHERE EMPTY(unpdrx.pu_date) ;
					AND unpdrx.ptnt_no = patient_master.patient_id ;
					INTO CURSOR unpdrxcl readwrite

			lcExportFile = PUTFILE("Export To","c:\UnPaid_Rx_List","CSV")			 
			IF !EMPTY(lcExportFile)
				SELECT unpdrxcl
				COPY TO (lcExportFile) TYPE CSV
			ENDIF
			*TMN 08/03/2010

		*!*			IF !EMPTY(lcExportFile)
		*!*				SELECT unpdrx
		*!*				COPY TO (lcExportFile) TYPE CSV
		*!*			ENDIF
		ENDIF
		*TMN 08/03/2010
ENDCASE 

SELECT UNPDRX
SET RELATION TO
SET FILTER TO
GO TOP

IF NOT POSCONFG.RX1
	SELECT PATIENT_MASTER
	USE
ENDIF

*SELECT UNPDRX
SELECT regtrans

IF mOnLine
	CloseBrow = .F.
ENDIF

Thisform.release

RETURN



*******************************************
Thanks for the help!
Tommy Tillman A+ NetWork+ MCP
Next
Reply
Map
View

Click here to load this message in the networking platform