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!

VB5, CR6 and Cannot Find SQL Server with Subreports 1

Status
Not open for further replies.

DarrellW

Programmer
Mar 19, 2001
10
GB
I am using VB5, CR6, and I have a report which has a subreport within it. When I run the report in the crystal report designer everything is fine.

I use the Crystal OCX control within my VB app, and when I try and run the same report it reports a runtime error 20599 Cannot find SQL server. If I amend the report and remove the subreport and run it within the VB app it works fine.

I presumme this has somehting to do with the fact that the subreport is not using the same data path as the main report. Does anyone know of a way round this ??

Rgds

 
Im having the same problem in the same environment, but My app runs fine over our test database(where I created the report), when I change it to run over the production data I get the same 20559 error your getting. If you find a way to fix this I would be interested.

Thanks
 
Was the subreport created as a stand-alone then 'imported' into the container report? Or was it created within the container?

Is the subreport linked to the container or is it not 'data-dependent) (using a param)?:cool:

ECS DataSystems, Inc.
A Crystal Partner
 
Hello EarlGray,

The subreports were created seperately and then I used the Insert Sub-report option and pointed to the existing reports I created, then I specified that the sub-reports were linked to main report by a field called 'locid'. Both the main report and sub-report look at the same data location.

Rgds
 
Hi all

I to have had this problemm bit I FIXED IT..... (cue fanfare of trumpets)

You need to pass the connection string to the subreport as well as the main report..... like this ---->>>

With CrystalReport1
.Reset
.LogonInfo(0) = strLogonString
.ReportFileName = "C:\MyMainReport"

''----------------------------------------------------
'** In this following line, you use the name of the
' sub report "control"... i.e. what appears in the
' status bar of the main report when you hover of
' the sub-report
''----------------------------------------------------

.SubreportToChange = "MySubreport.rpt"
.LogonInfo(0) = strLogonString

''------------------------------------------------------
'** Not sure if you need this or not, but what the hell
''------------------------------------------------------
.SubreportToChange = ""

.WindowState = crptMaximized
.Destination = crptToWindow
.action = 1
End With

Give this a whirl and see what happens.... it worked for me..

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top