|
Hi all, I just registered and this is my first post. I hope you can help me.
I was given the task of resurrecting an old report made using CR9 and called from an application written in VB6. The report stopped working when the database was moved to new servers. I have made the necessary changes to the report and the calling app and it is now functional. The report uses one subreport which is included twice within the main report so that the report will print twice within the same letter sized page.
We have three database servers housing the same database. Two are regional servers and the third is a development server. I did all work and testing (successfully) on the dev server; however, when further testing required the use of one of the production servers I got the error "Unknown query engine error". I have searched for a solution, but have not found anything useful.
The problem seems to happen when a specific server and database is defined within the report file (using the Set DB location option) and the app passes the log on credentials of the other server. For example, the two servers are named CorpDataAt and CorpDataPac. If I set the report to use CorpDataAt using the Set DB location option then I log on to CorpDataPac in the application and call the report using these credentials the error happens. Same if CorpDataPac is defined within the report and the app passes CorpDataAt name and log on credentials to the report.
For some strange reason the report works well when run against the development server regardless of which server is defined within the report. I don't understand why I can't have one server defined in the report and use another server when I run the report. Some sample code follows:
'Notes: sSrv, sDB, sUsr & sPwd are previously defined and passed to ' the report generating function. ' sSubRptName & sRptFile are also passed to the function and ' contain the sub report name and the main report full file spec, ' respectively. ' rs01 and rs02 are open ADO record sets and contain the ' data that will be in the report. ' fFindRepTbl(sTableName) is a functionthat returns the correct ' Tables() index for the table name given. 'Open the report Set crReport = crApp.OpenReport(sRptFile)
'Set log on credentials dynamically crReport.Database.Tables(1).ConnectionProperties("Data Source") = sSrv crReport.Database.Tables(1).ConnectionProperties("Initial Catalog") = sDB crReport.Database.Tables(1).ConnectionProperties("User ID") = sDBUsr crReport.Database.Tables(1).ConnectionProperties("Password") = sDBPwd
'Open subreport (twice for each half of the page) Set crReportSub = crReport.OpenSubreport(sSubRptName) Set crReportSub01 = crReport.OpenSubreport(sSubRptName & " - 01")
crReport.DiscardSavedData crReportSub.DiscardSavedData crReportSub01.DiscardSavedData 'Pass the new data to the report file. crReport.Database.Tables(fFindRepTbl("Cust")).SetDataSource rs01, 3
crReportSub.Database.Tables(fFindRepTbl("Detail")).SetDataSource rs02, 3 crReportSub01.Database.Tables(fFindRepTbl("Detail")).SetDataSource rs02, 3
frmCR9Report.Visible = False frmCR9Report.CRV9.ReportSource = crReport frmCR9Report.CRV9.ViewReport 'Error happens here frmCR9Report.CRV9.EnableGroupTree = False 'The report stays onscreen until the user exits, frmCR9Report.Show vbModal
I hope that this is something I overlooked. Any help is appreciated, thank you. Sgarv
|