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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport reports old data

Status
Not open for further replies.

RPrinceton

Programmer
Jan 8, 2003
86
US
Hi All,
At run time I am trying to change the file from which a subreport gets it data. I believe the code snippet below is correct, however at run time the subreport presents old data i.e., the data from the path I used at design time. I have ensured that the report does not save data both in the main report and subreport. I have also ensured that the path is correct. What subtly am I missing? Please advise. Thx in advance.
Regards,
RPrinceton


Code snippet:
CrystalReport1.ReportFileName = d:\VB\NFLPredictions\CrystalReports\Predictions.Rpt
CrystalReport1.SubreportToChange = "Epilog.rpt" <-- subreport
CrystalReport1.DataFiles(0) = "D:\VB\NFLPredictions\AltInputs\Epilog\RptInp.txt" <--new data
CrystalReport1.SubreportToChange = ""
CrystalReport1.Destination = crptToWindow
CrystalReport1.Action = 1
 
Interesting that you set the CrystalReport1.SubreportToChange and then set it to blank before execution, doesn't look right to me.

Looks like VB code for the Crystal RDC, but you should always state your Crystal version and whatever other code is being used to assure clarity.

Here's the sample apps:


I did VB many years ago so I'll just provide the samples.

-k
 
Hi synapsevampire,
Thank you for the info. I am using Crystal Reports 8.0.0.0.377 with VB 6 SP6 and apologize for not including it in the original correspondence. I have tried a few of the examples and they don't work either. I can say with certainty that at run time Crystal Reports is using the file path I used at design time to populate the report. I proved this by renaming the path to something else and running the program. It displayed an error indicating that it was unable to Log on to the server. Perhaps a restatement of the steps I took and what I am trying to accomplish will shed some light on a solution. I developed two Crystal reports one main report and a one subreport that use ascii files. Because they are ascii files I had to create an ODBC datasource for each of the reports. The schemas generated reside in the SAME directory as the data at DESIGN time. Here is what I am trying to do. At run time I am going to have different places on the hard drive where the data can be stored for Crystal to report on. I want to point Crystal Reports to where the DYNAMIC data resides which will be somewhere different than at design time. It's analogous to porting the program to a another user's machine, running the report and telling Crystal the new location of the data and using the correct schema. The way it works now is I would have to set up the same directory structure I used at design time on every user's machine on which I would install this application and ensure the data ends up in the same place it does at design time It seems extremely limiting and impractical.
Is there a way to point Crystal to a directory of your choice at RUN time to obtain the data to report on?
Please advise. Thx in advance.
Regards,
RPrinceton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top