Mutiple supreports with Crystal report

Posted on 2003-03-27
Medium Priority
Last Modified: 2011-10-03
Hi I am a programmer for a company called Matiss inc in Quebec.

My problem is this :

We are using VB 6 enterprise to communicate with Crystal Reports 8.5,
C.R. is connected to a SQL Server 2000 database.
We are using Crystal report OCX “Crystl32.ocx VS”

By calling Crystal Report from our VB Application we set the data source using the object’s properties. The problem is if the name of the server changes the sub report are no longer linked to the database.

i have found "SubReportToChange", "GetNSubreports" and "GetNthSubreportName" but i cant figure out how to use SubReportToChange...

Any suggestions would be very helpful.
Question by:CajunX
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 8217458
This is very important

Accepted Solution

hmadhur earned 300 total points
ID: 8217814
You have found the solution yourself. SubReportToChange is the function to be used when you want to propogate any changes to the subreport.

When you call SubReportToChange, Crystal Reports loads the subreport into the memory. So any function call to change the Data Source or any other property changes you make will be directly sent to the subreport. For Eg: If you have a Report with two subreports named SubReport1.Rpt and SubReport2.Rpt. You want to change the SQLQuery property of SubReport1.Rpt. First you call SubReportToChange with the SubReports name. viz.

ActivexControl1.SubReportToChange = "SubReport1.Rpt"
'Any property changes after this statement will happen for SubReport1.
ActivexControl1.SQLQuery = strSql

The SQLQuery property will be set for the subreport.

When you want to revert back to the main report call SubReportToChange with empty string.

ActiveXControl1.SubReportToChange = ""

This will return the control to the main report.

Hope I got it right. Let me know if you want anything more.
By the way, Quebec is in Canada, isn't it? Wonderful place. I am trying for a job there. Right now I am in Dubai, UAE.


Expert Comment

ID: 8531522
Hi CajunX,
This old question (QID 20565063) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.

Expert Comment

ID: 9440936
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept hmadhur's comment as Answer

Please leave any comments here within the next seven days.


Cleanup Volunteer

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question