Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1831
  • Last Modified:

crystal reports 8, subreports, visual basic 6

Hello,

I have a Visual Basic 6 application calling a crystal report version 8 with a subreport. When attempting to invoke the crystal report it errors with "can not open SQL server - 20599." I have other crystal reports without subreports that work fine in the same application. The code is as follows:

Private Sub cmdSummary_Click()
Dim ODBC_String As String

On Error GoTo ErrorHandler
ODBC_String = "DSN=btireports.dsn;DSQ=" & pubstrDatabase & ";UID=bti;PWD=zoe"

crpReports.Connect = ODBC_String

If Me.cboDepartment <> "All" Then
    crpReports.StoredProcParam(0) = Mid(Me.cboDepartment, 1, 7)
Else
    crpReports.StoredProcParam(0) = Me.cboDepartment
End If
crpReports.ReportFileName = pubstrReportLocation & "ConsolidatedDeptDivLevelQuarterly.rpt"
crpReports.Action = 1

GoTo ExitSub

ErrorHandler:
    MsgBox "Printing Summary Report:  " & Err.Description & " Error # " & Err.Number
ExitSub:

End Sub

Any help on why subreports do not work correctly in this context would be greatly appreciated.

Thanks,

Joe
0
jcmyers
Asked:
jcmyers
  • 2
  • 2
2 Solutions
 
ebolekCommented:
You are not setting login info and parameter of the subreports . Check these dicuments out. Thye will solve your problem

http://support.businessobjects.com/communityCS/FilesAndUpdates/cr8_vb_rdc_parameter.exe.asp 
http://support.businessobjects.com/library/kbase/articles/c2003098.asp 

Regards
Emre
0
 
vidruCommented:
Looks like you're using the OCX, eh?

Try adding this before "crpReports.Action = 1":

crpReports.SubreportToChange("YourSubreportName")
crpReports.Connect = ODBC_String
crpReports.SubreportToChange("")

If you don't have the Help files for the OCX, you can get them here:
http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR_OCX_Help.exe.asp?recDnlReq=Record&dnlPath=SCR_OCX_Help.exe

-dave
0
 
vidruCommented:
Suggest points to vidru.

-dave
0
 
ebolekCommented:
Comment from ebolek
Date: 10/07/2004 02:07PM PDT
 explains how to make the runtime customizations that the user asked in vb6 there fore suggest points to ebolek

Thanks
Emre
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now