I have a VB6 app that allows user to select, view and print Crystal Reports developed in 8.5. My app worked fine until I put together a report with a subreport. I used the code below which I found in Crystal's knowledgebase, but when I step through the lines, I find that the .DataFiles are pulling from the main report, not the subreport.
Before arriving at the above code, my program has set the DB location for the main report using nearly the same procedure. After the .SubreportToChange statement, the program tells the report to run.
I've banged my head against the wall for a couple of weeks now (off & on) and appreaciate any help you can offer. :^)
Code:
If SubReportExists = True Then
For SubReportLoopCount = 0 To SubReportCount
.SubreportToChange = .GetNthSubreportName(SubReportLoopCount)
TabCount = .RetrieveDataFiles
For FilesLoopCount = 0 To (TabCount - 1)
strTemp1 = .DataFiles(FilesLoopCount)
SlashPos = InStrRev(strTemp1, "\")
strTemp2 = Right$(strTemp1, Len(strTemp1) - SlashPos)
If LCase(Right$(strTemp2, 3)) = "smd" Then
.DataFiles(FilesLoopCount) = PathtoData + strTemp2
End If
If LCase(Right$(strTemp2, 3)) = "mkd" Then
.DataFiles(FilesLoopCount) = PathtoApptData + strTemp2
End If
Next FilesLoopCount
Next SubReportLoopCount
End If
.SubreportToChange = ""
I've banged my head against the wall for a couple of weeks now (off & on) and appreaciate any help you can offer. :^)