-
1
- #1
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.
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.