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

Distributing CR 8.5 Report with TTX file

Status
Not open for further replies.

dstepans

Programmer
Jun 3, 2003
39
0
0
US
Hi,

I will need to distribute a CR 8.5 report which uses ttx files. It looks like it needs ttx files for it to run. Is that so? If yes how do I set their (ttx fileS) location dynamically (depending where the user installs the app?).

Would a better solution be integrating the report into VB6 using ActiveX Designer? In this case would I still have to destribute ttx files?

TIA,
Denis
 
In my case, I have a report that is installed in the application directory and I place the ttx file in the same directory. In the report itself, under the Database | Set Location option, the location looks like:

Trade_Report.ttx

There is no file path specified, so the report will look to the current directory for the ttx file. Is that what you want?
 
Yeap, thanks, that will work.

What about if I integrate this report in VB using ActiveX Designer, would I still have to include the file?

Denis
 
To be honest, I don't know. The point of the ttx file is to allow a person to develop a report when they don't have connectivity to the database. Since one normally has connectivity to a database when developing a vb app (assuming your app is more than just a launcher for the report), I would be inclined to change the report to be ADO based (i.e., choose Database | Set Location, and choose Location | Active Data | ADO, establishing an ADO connection and SQL statement that returns a resultset that matches the schema of your ttx file). You use the same driver (p2smon.dll) in either case, but you would be skipping the ttx file this way.
 
The problem is I want to give my app some flexibility. The application works with both Access and SQL server.

I am using ADO but assigning recordsets to the report in VB code. I create a recordset and then assign it to the report using this code:

Report.DiscardSavedData
Report.Database.SetDataSource rs

Is there any other way to do it?

Denis
 
The problem is I want to give my app some flexibility. The application works with both Access and SQL server.

I am using ADO but assigning recordsets to the report in VB code. I create a recordset and then assign it to the report using this code:

Report.DiscardSavedData
Report.Database.SetDataSource rs

Is there any other way to do it?

Denis
 
Guys,

I am pretty sure that you should only need the TTX file during design time. If your record set matches the TTX exactly, the report should accept it without looking for a TTX. If it is looking for the TTX, then you may not be passing the recordset correctly.

I would not discard the saved data in the code, I would make sure the report is saved WITHOUT data. That might be why it is looking for the TTX.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Denis:

How is your approach not flexible? Using an ADO recordset is the most flexible approach. Whether you use a ttx file or the approach I outlined, if you are assigning an ADO recordset at runtime, what do you find limiting?

I would defer to Mr. Hamady on whether or not you need the ttx file, but using discardsaveddata shouldn't cause you any problems...it may be unnecessary, but other than a minute performance hit, there should be no other consequence.
 
Thanks guys.

Just wanted to know if I do need to use ttx files for my approach or is there any other way, and if I need to distribute ttx files with my application.

I was having trouble with subreports (I am assigning ADO recordsets to them as well). The main report is printing fine, but the data in subreports sometimes won't print.

Denis
 
Are you using the ReadRecords method with the subreports before viewing or printing the report?
 
Just the same SetDataSource method.
Here is the code to set the main report and 2 subreports that I use:

Report.DiscardSavedData
Report.Database.SetDataSource rs

Report.OpenSubreport("Diagnosis").DiscardSavedData
Report.OpenSubreport("Diagnosis").Database.SetDataSource rsDiagnosis
Report.OpenSubreport("Procedures").DiscardSavedData
Report.OpenSubreport("Procedures").Database.SetDataSource rsProcedures
 
Try using the following before viewing or printing the report (for clarity, I've created subreport objects:

Dim SubRptDiagnosis as CRAXDRT.Report
Dim sbuRptProcedures as CRAXDRT.Report


Set SubRptDiagnosis = Report.OpenSubreport("Diagnosis")
With SubRptDiagnosis
.DiscardSavedData
.SetDataSource rsDiagnosis, 3
.ReadRecords
End with

Set SubRptProcedures = Report.OpenSubreport("Procedures")
With SubRptProcedures
.DiscardSavedData
.SetDataSource rsDiagnosis, 3
.ReadRecords
End with

 
dstepans, You do not need to distribute the .ttx files. They are only used during design time. The .rpt file will keep a copy of the .ttx format so that it knows the format of the Active data that it can accept. The data can be passed to the report via an ADO recordset or as a CDO rowset object.

I use this method when I don't have any information about the database on which to base the report (ei, type, location, name, etc.)

Take Care,

zemp

"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
 
Thanks guys, sorry took so long to reply, had to leave for the weekeng, just got back.

FVTrainer: I get object does not support this property or method errror on this line: .SetDataSource rsDiagnosis, 3

But anyway found the thing that caused the subreport not to print. The details section before the details section of subreport was set to a new page, for some reason that caused the subreport data to dissapear (just titles of the fields were printed), I disabled New Page and now it seems to work.

Got another problem though.
I tried adding the created rpt report to my vb6 app. using ActiveX Designer. On my development pc the report works fine, but when I distribute it, it gives the following error:

Cryastal Report Viewer:
The field name is not known

Do you guys know whats causing it?

Denis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top