For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > April 2006 > Subreports not found.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Subreports not found.
jatinbhatt@gmail.com

2006-04-10, 7:05 pm

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

Clinton

2006-04-11, 4:07 am

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com