I'm trying to write a general report handler as class in an ActiveX exe. The code beneath is pretty self explanatory. Pass in a recordset and reportname, create the report, give it the recordset and print.
The thing specified by ReportName must be a Crystal 8 Designer already defined in the project. If I try to do this I get 'ActiveX can't create component'.Code:Private mObjReport as Object Public Sub PrintReport(ReportName As String, rs As Recordset) 'Pass in the report name and recordset to be printed Set mObjReport = CreateObject(ReportName) mObjReport.Database.SetDataSource rs mObjReport.PrintOut End Sub
If I do
it works fine. If I pass in the string 'CrystalReport1' and use that in CreateObject, I get the can't create component error. Am I trying to do something impossible or am I just doing something wrong?Code:Private mRptReport as New CrystalReport1




Reply With Quote