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

using acitve data in a subreport 1

Status
Not open for further replies.

Hubajube

Programmer
Mar 6, 2002
25
US
I came across a little glitch and found a solution. I thought I'd pass it along. I have a report that uses active data with embedded subreports that also use active data. The active data definition (TTX) files are kept in the same directory as the RPT files. Everything was fine when we tested the report, but when we installed it on the user's server, Crystal couldn't find the TTX files for the subreports.

It seems that for the main report, you can simply specify the TTX file name without a directory, and Crystal will look for it in the same path that the RPT file is in. For the subreports, though, a directory seems to get embedded in the TTX location. Because of this, if the install location is changed, as it was for our client, the subreport will still be expecting the TTX to be located in the directory that it was in when the RPT was saved by the programmer.

The workaround isn't difficult, but it takes a little digging into the object model. Since I was using active data for the subreport, I was already looping through the main report's report objects to find the subreports and then using oSubRpt.Database.SetDataSource to give it its data. The solution to the TTX location problem was to add a line immediately before the SetDataSource line that pointed the subreport in the right direction:

oSubRpt.Database.Tables(1).SetLogOnInfo sRptDir & oSubRpt.Database.Tables(1).Location

where sRptDir is the install directory for the RPT and TTX files.
 
I don't think you need the TTX file at all once you are passing a recordset in your app. That should be a temporary file used only to develop the report. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top