Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report 11 subreport code.... Post Reply Post New Topic
Author Message
intellogo
Newbie
Newbie


Joined: 05 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote intellogo Replybullet Topic: Crystal Report 11 subreport code....
    Posted: 07 Apr 2007 at 5:02am
Hi crystalians,

With reference to the Crystal Report 11 product, I have created 2 sub-reports from 2 unrelated tables: A and B. Then inserted them onto one blank master report in the Report Header section.

I need to pass SQL statements from within Visual Basic 6.0 to the sub-report so it will correctly query the records. I know how to do this with normal reports...but not with subreports. I usually use the ".SQLQueryString" property to process SQL statements in VB code.

Now, with reference to Visual Basic 6.0, can anyone enlighten me on how to pass the sql statements to query the records from VB6 onto a subreport, correctly.

Awaiting urgent reply....



Edited by intellogo - 07 Apr 2007 at 6:50am
Regards,
intellogo
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 09 Apr 2007 at 11:11am
I don't code in VB, so I don't know the exact syntax.  However, here's what the code to get to the subreports looks like in C#.  Once you get to the subreport, I think you can then set the .SQLQueryString for the individual subreport.
Sections sections = reportDocument.ReportDefinition.Sections;
foreach (Section section in sections)
{
  ReportObjects reportObjects = section.ReportObjects;
  foreach (ReportObject reportObject in reportObjects)
  {
    if (reportObject.Kind == ReportObjectKind.SubreportObject)
    {
      SubreportObject subreportObject = (SubreportObject.reportObject);
      ReportDocument subReportDocument =
        subreportObject.OpenSubreport(subreportObject.SubreportName);
      //add your code here....
    }
  }
}
-Dell
IP IP Logged
intellogo
Newbie
Newbie


Joined: 05 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote intellogo Replybullet Posted: 09 Apr 2007 at 12:20pm
Hilfy..thanks for showing ur helping hand..but I am sory to inform u that my code in VB6 is somewhat very similar to yours in a conceptual manner and partly in code, too....But i cannot relate ur code to my environment.
If u could kindly get hold of some Visual Basic 6.0 and Crystal Report 11 person who has more in-depth knowledge about subreports and its integration with VB6, then please let me know. I could proceed by probably sending the related part of my code to him for checking and recieve modifications wherever necessary.

Awaiting ur response very urgently....
Regards,
intellogo
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 09 Apr 2007 at 12:32pm
Wish I could help on this one, but I'm not a VB6 guy either. Have you checked out this book on VB6 and Crystal Reports? It might help you, but it doesn't have the best reviews so its a risk. But its your only resource for VB6 nowdays.

http://www.amazon.com/exec/obidos/ASIN/1930919387/bischofsystem-20

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
intellogo
Newbie
Newbie


Joined: 05 Apr 2007
Location: United Kingdom
Online Status: Offline
Posts: 10
Quote intellogo Replybullet Posted: 09 Apr 2007 at 12:58pm
Brian pal,
 
At this moment, i cannot think of openning a new book and risking my time.
 
I just need a more knowledgable person who can check my subreport in vb6 code and tell me where i am going wrong...thats it.
 
If u do get anyone please tell him abt my issue.
 
 
Regards,
intellogo
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.