Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgraded to CR11 problem with VFP.

Status
Not open for further replies.

paulmtl

Programmer
Feb 25, 2005
27
CA
Hi all,

This procedure is to print a crystal report version 7 without any problems at all, but I ugraded to version to version 11, I have this error message :

Crystal report error ! Error number 20525
Error message : Unable to load report

exactly from the codes trapping error section as :

due to the error is different from 0 ( zero )

IF .LastErrorNumber <> 0
_SCREEN.MOUSEPOINTER = 0
lcMsg = "Crystal Report Error! Error nunmber: "+ALLTR(STR(.LastErrorNumber))+CHR(13)+ ;
"Error Message: "+.LastErrorString
oApplication.Update_Error(.LastErrorNumber, lcMsg, MESSAGE(1), LINENO(1), PROGRAM(), ALIAS(), ORDER(), SYS(18), WONTOP())
RETURN
ENDIF




PROCEDURE DoPrint
*================================================
LPARAMETERS tcReportName, tlShowGroupTree, tcWindowTitle
LOCAL loCrystalReport, lnResult, lnHandle, lcMsg
LOCAL lcCR_DSN, lcCR_USR, lcCR_PWD, lcCR_SourcePath, lcFile, lcMsg

IF TYPE("loCrystalReport")<>"O" AND !ISNULL(loCrystalReport)
loCrystalReport = CREATEOBJECT("Crystal.CrystalReport")
ENDIF

lcCR_DSN = Mem_DataSource_Name &&GetIni("REPORTS", "DSN", gcIni)
lcCR_USR = gcCR_USR &&GetIni("REPORTS", "USR", gcIni)
lcCR_PWD = gcCR_PWD &&GetIni("REPORTS", "PWD", gcIni)


lcCR_SourcePath = GetIni("REPORTS", "SourcePath", gcIni)

lcFile = lcCR_SourcePath + tcReportName
IF !FILE(lcFile) && si le fichier cystal report n'existe pas

lcMsg = ;
"Error : File not found!" + CHR(13) + ;
"Report: '" + lcFile + CHR(13) + ;
"Erreur : Fichier non trouvé!" + CHR(13) + ;
"Rapport: " + lcFile

MESSAGEBOX(lcMsg,16,IIF(!EMPTY(tcWindowTitle),tcWindowTitle, "File not found!"))
loCrystalReport = NULL
RELEASE loCrystalReport

RETURN .F.
ENDIF

WITH loCrystalReport

*.CONNECT = '"'+"DSN = "+lcCR_DSN+";UID = "+lcCR_USR+";PWD = "+lcCR_PWD+";DSQ = "+lcCR_DSN+'"'
*.CONNECT = '"'+"dsn="+gcCR_DSNNative+"; uid="+lcCR_USR+"; pwd="+lcCR_PWD+"; dsq="+Mem_SQLDatabase+'"'
.CONNECT = "dsn="+lcCR_DSN+"; uid="+lcCR_USR+"; pwd="+lcCR_PWD+"; dsq="+Mem_SQLDatabase


.ReportFileName = lcCR_SourcePath + tcReportName
.DiscardSavedData = 1
* .WindowHeight = 500
* .WindowWidth = 580
.WindowLeft = 100
.WindowMaxButton = .T.
.WindowBorderStyle = 2 &&sizable
.WindowControlBox = .T.

.WindowTitle = tcWindowTitle
.WindowShowGroupTree = .T.
.ProgressDialog = .T.
.Destination = 0 && Window

*.Action = 1
lnResult = .PrintReport()


IF .LastErrorNumber <> 0
_SCREEN.MOUSEPOINTER = 0
lcMsg = "Crystal Report Error! Error nunmber: "+ALLTR(STR(.LastErrorNumber))+CHR(13)+ ;
"Error Message: "+.LastErrorString
oApplication.Update_Error(.LastErrorNumber, lcMsg, MESSAGE(1), LINENO(1), PROGRAM(), ALIAS(), ORDER(), SYS(18), WONTOP())
RETURN
ENDIF

lnHandle = GetActiveWindow()
DO WHILE IsWindow(lnHandle )<>0
DOEVENTS
*--just in case...
IF LASTKEY()=27
EXIT
ENDIF
ENDDO

ENDWITH

loCrystalReport = NULL
RELEASE loCrystalReport

RETURN


Please help to explain why is caused this error?
That could be from : OLECONTROL, ACTIVE X or the codes
is not acceptable for CR11 report.

Any advices or suggestions would be greatly apppreciated.
TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top