Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

chaging subreport location-run time 1

Status
Not open for further replies.

olichap

Programmer
Mar 20, 2001
389
US
I have a report w/ 4 subreports. All five call stored procs. I know how to change the location for ONE report at through VB. My problem is finding an efficient way to change the locations for all 5 reports. Any suggestions??

Oliver
 
Hello

What you might want to try is to use the SubreportToChange method for the subreports. for example if you are using the connect property then you would use it also for the subreport using the SubreportToChange. here is a sample of what I mean

CrystalReport1.Connect = &quot;PWD=<password>&quot;
CrystalReport1.SubreportToChange = CrystalReport1.GetNthSubreportName(0)'Change toSubrpt1
CrystalReport1.Connect = &quot;PWD=<password>&quot;
CrystalReport1.SubreportToChange = CrystalReport1.GetNthSubreportName(1)'Change toSubrpt2
CrystalReport1.Connect = &quot;PWD=<password>&quot;

and so on for all your subreports.

Hope this helps/ E. McEvoy
Crystal Reports Consultant
 
Thanks E.,

Right now I am looping through like this:

dim rptSubRpt as CraxDrt.report
dim report as CraxDrt.report

For iint = 2 To 5
Set rptSubRpt = Report.OpenSubreport(&quot;rptSavPatientSumm&quot; & iint)
rptSubRpt.Database.Tables(1).Location = &quot;SQL.dbo.Proc(rptSavSum_pg&quot; & iint & &quot;NPar;1)&quot;
Next iint

Since my stored proc names are, excepting a number, the same this seems to work. It will not be quite as simple if/when I am using different names but should be flexible enough to handle that as well. I am going to play around with the example you gave me, to see if I like it better. In the end I want this to be as straight forward as possible.

Thanks again,
Oliver
 
I am using Crystal 8.0.0.371 and Visual Basic 6.0. I am having a hard time resolving a issue related to Sub-Report embedded in a primary report. I have over 40 Sub-Report, which I guess is alot, I'm not sure of the limits. But when I reach the the 40th Sub-Report in the loop, Crystal goes back and get the name of the first Sub-Report instead of the 41st Sub-Report.

I'm not that skilled in VB or Crystal but could use some help, please
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top