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
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