Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, I have a developed an application using VB6, Sql Server 2005 and Crystal Report 9. I use the CR control (crystl32.ocx) to print reports. All the reports work fine. But If a report has subreports, I need to reference the subreports in order to set the database to them. I am using the GetNSubreports method of the CR control, it always return zero indicating that the report has no subreport. I am really baffled at this behaviour. Why does it not return the subreport count? My code snippet is given below: CR.ReportFileName = App.path & "\Test.rpt" CR.Destination = crptToWindow Y = CR.GetNSubreports() Y always returns 0 even thought the Test.rpt report has subreports. Please advice. Thanks Jatin
Post Follow-up to this messageYou need to get away from using the CR Ocx. While I didn't have a problem getting using the GetNSubreports, I did with RetrieveDataFiles after changin g to the subreport. The Ocx doesn't report back correctly using and RetrieveDataFiles after changing to a subreport (it always returns the number of datafiles from the main report). The Ocx is also limited and has some other quirks, along with being extremely outdated (last time it was actually updated by CR was with the 6.0 version back in 1997 I believe) Using it, you will have to know the subreports names ahead of time. Better to use the crystal report engine dll. There are examples on the CR CD or in the installation folder, it the samples were installed. As a temporary solution you can still reference the CR Engine while continuing to use the OCX, just to get the number of subreports and their datafiles for a certain Rpt. "jatinbhatt@gmail.com" wrote: > Hi, > > I have a developed an application using VB6, Sql Server 2005 and > Crystal Report 9. I use the CR control (crystl32.ocx) to print reports. > > All the reports work fine. > > But If a report has subreports, I need to reference the subreports in > order to set the database to them. I am using the GetNSubreports > method of the CR control, it always return zero indicating that the > report has no subreport. > > I am really baffled at this behaviour. Why does it not return the > subreport count? > > > My code snippet is given below: > > CR.ReportFileName = App.path & "\Test.rpt" > CR.Destination = crptToWindow > > Y = CR.GetNSubreports() > > Y always returns 0 even thought the Test.rpt report has subreports. > > > Please advice. > > Thanks > Jatin > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.