Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: [RESOLVED] Issues with Subreports 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: [RESOLVED] Issues with Subreports
    Posted: 05 Apr 2007 at 9:50pm
Hi,

I have a report desigend in Crystal Report 11. The report has 2 sections which is divided in between by a simple dark line.
The report's left side has the fields of TABLE A and will be used to show records from TABLE A only.
And the report's right side has the fields of TABLE B and will be used to show records from TABLE B only.

I thought of the following idea:
The best & easiest thing is to pass 2 different SQL statments in vb code on the form_load event. One for table A and the other for table B, so that i can view information of the records on the left side of the report for TABLE A and records on the rght side of the report for TABLE B, when the report is displayed.

I am using the ".SQLQueryString" property for processing SQL statements in vb code view to produce an output in the report at runtime...which has worked perfectly for my other reports.

OBJECT SUMMARY: Displaying records from two seperate tables on either side of the report.
Do any of u guys know how to do this.. ??

Any good techie help will be gr8tly appreciated.
Awaiting reply A.S.A.P.....

Edited by intellogo - 07 Apr 2007 at 4:44am
Regards,
intellogo
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Apr 2007 at 1:00am
Crystal Reports can display data from two non-joined tables in the same section. That is why we have sub-reports so that you can put a subreport in a new section and display the other table there. The only way to do what you want to do is to build a dataset outside of Crystal Reports. In VB.NET you would open both tables and then start at the beginning of each one and copy the fields into a record in a third dataset. Process each record from Table A and B like this while copying their data into a third Table C. Once you've processed all the records then pass Table C to the Crsytal Report and display it.

You gotta know how to write some serious code to pull this one off.
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: 06 Apr 2007 at 3:25am
Originally posted by BrianBischof

Crystal Reports can display data from two non-joined tables in the same section. That is why we have sub-reports so that you can put a subreport in a new section and display the other table there. The only way to do what you want to do is to build a dataset outside of Crystal Reports. In VB.NET you would open both tables and then start at the beginning of each one and copy the fields into a record in a third dataset. Process each record from Table A and B like this while copying their data into a third Table C. Once you've processed all the records then pass Table C to the Crsytal Report and display it. You gotta know how to write some serious code to pull this one off.


Gooday and Thanks a lot to get me rocketted at the
correct direction in this strange issue.
Are u trying to say that I would need to make use of the conecpt of a database "view" (which is a virtual sort of third table in buffer), to pull this thing correctly ???

I am using Visual Basic 6.0 and Microsoft ACCESS 2000. So, according to ur reply, I will have to query records from table A and table B (which are unrelated) and write them / transfer them to a thrid table called C. All this I will be doing through VB6 code.And then simply query all TABLE C's records with use of the ".SQLQyeryString" property which I was using normally to show records finally onto the crystal report.

Is the above conclusion correct as per what you are trying to explain to me ???

Awaiting your experienced reply....
Regards,
intellogo
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Apr 2007 at 11:23am
Yes, that is correct. However, what I don't know how to tell you is the way to do this in VB6. In VB.NET I would do it by creating a new DataSet object (an in-memory table), what I called Table C, and after it is populated I would pass that as the datasource to the report. Takes a bit of code, but nothing complex. In VB6 I don't know if you can create an in-memory table as use that as the datasource for a report.

If VB6 can't do this, a couple other options are to make Table C as a CSV file that is created dynamically by VB6 and have CR report off of that. You could also do this using a stored procedure if you are a guru at using cursors and working with temporary tables.

So you have a couple choices before you depending upon your skill set.
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: 06 Apr 2007 at 11:21pm
Originally posted by BrianBischof

Yes, that is correct. However, what I don't know how to tell you is the way to do this in VB6. In VB.NET I would do it by creating a new DataSet object (an in-memory table), what I called Table C, and after it is populated I would pass that as the datasource to the report. Takes a bit of code, but nothing complex. In VB6 I don't know if you can create an in-memory table as use that as the datasource for a report.If VB6 can't do this, a couple other options are to make Table C as a CSV file that is created dynamically by VB6 and have CR report off of that. You could also do this using a stored procedure if you are a guru at using cursors and working with temporary tables.So you have a couple choices before you depending upon your skill set.



Hi..buddy Bischof,

Firstly, i gr8tly appreciate ur interest and consistency in helping me...THANX
I have changed it and will need ur asistance more now..
I have deleted that old report.

I made a new blank report and placed 2 sub-reports on the blank report.Each of these 2 sub-reports display records of the 2 unrelated tables..as I wanted it to work...but this is in crystal report 11 product only.

Now how do I do it in VB6 code ?
For my other reports that were being generated, I had a VB Form having a "View Report" button which would at runtime generate the reports.

But now I am tackling the issue of sub-reports and have no knowledge of the vb6 code that is required with sub-reports.
Normally, for the other reports, I was using the ".SQLQueryString" prop to feed-in the SQL statement in VB6 code. But how do I do it now. I mean to say there's a new way I guess to work it out with sub-reports..Can someone throw light on this..

Awaiting the crystally replies...
Regards,
intellogo
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Apr 2007 at 11:30pm
I'm not much of a VB6 guy. When I needed to do runtime customization in VB6 I would switch to Active Reports. My forte is in .NET now. Sorry.

Why can't you create the subreports with the proper SQL in them in design mode? Is this custom SQL that you use each time? In .NET you would reference the subreport from properties in the main report. But again, I don't know the API for VB6.
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: 07 Apr 2007 at 12:59am
Hi Brian,
I don't know the Crystal or Basic syntax needed to code the CR 11 reports within the CR 11 product, so I do it in VB6.I am now only stuck in this subreport thing.

QUESTION 1:
===========
I want to know what is the different code that I'll have to write for these new subreports. ???

QUESTION 2:
===========
In which of the sections of the main report (Report Header, Repor Footer, Page Header, Page Footer, Details)do I place the sub-report in, so that it will display properly at runtime in my vb6 s/w via the CrystalActiveXReportViewer control ???

I have currently placed it in the "Report Header" section and I can see the preview of a detailed subreport in CR 11 product/IDE ..but in VB6, its smiply 2 blank boxes (at runtime)....

Please help me out...

Edited by intellogo - 07 Apr 2007 at 1:00am
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.016 seconds.