Link to home
Start Free TrialLog in
Avatar of awp5379
awp5379

asked on

How to change connection of subreport in VB6.

I have a Report with a subreport. When viewing the report through the CRreport designe, the report and subreport work fine (testing against a test database).

Now, when I run the report against the production database, the report preview does not open. When looking at the the CrystalReport control, I get the following error:
Cannot open SQL server (err#: 20559).

I know the problem is that the subreport logoninfo is not being updated. If I remove the subreport - the report will then work through VB. How do I specify the connection string for the sub report. The subreport is using a stored procedure to return its data.

Source:

    With Form1.CrystalReport1
        .Reset
        .LogonInfo(0) = strConnectString
        .ReportFileName = "C:\Program Files\Reports\IHateSubReports.rpt"
        .StoredProcParam(0) = strParam1
        .Destination = 0 'Print preview window
        .PrintReport
    End With
ASKER CERTIFIED SOLUTION
Avatar of awp5379
awp5379

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial