La Web del Programador: Comunidad de Programadores
 
    Pregunta:  15732 - SEAGATE CRYSTAL REPORTS
Autor:  Flover Sánchez Ortega
Tengo un repote con subreportes en Seagate Crystal Reports 7.0
Utilizo un canal ODBC para la conectividad (En SCR los subreportes no heredan la conexión, es decir cada uno utiliza el ODBC a SQL Server 2000/70).

En la implementación, aunque configuro bien el canal ODBC en el cliente; no me encuentra el servidor ("Can not find SQL Server").
Mi solución: Desde código le envío la cadena de conexión parametrizada antes de abrir el reporte.
¡Necesito una que no involucre el código, sólo el reporte y el ODBC, y yo sólo llame al *.rpt!

El problema que no he podido resolver (Ni por SCR Automation ActiveX) es:
¿Si un reporte maestro recibe una cadena de conexión desde su llamado, cómo hace para heredar esta cadena a los subreportes?

  Respuesta:  Roberto Avalos V.
Mira te envio un fragmento del codigo que yo utilizo para abrir el Reporte con ODBC, espero te sea util....

Nota que yo utilizo CR8 y visualizo el reporte en un CRViewer...

Este es un fragmento del codigo completo verás que hay variables declaradas que no se utilizan y es que pertenecen al fragmento del codigo que no te estoy enviando.

Espero que este código te sea de utilidad y me mandes tus comentarios.

Private Sub AbreReporte()
Dim crpTables As CRAXDDT.DatabaseTables
Dim crpTable As CRAXDDT.DatabaseTable
Dim crpParams As CRAXDDT.ParameterFieldDefinitions
Dim crpParam As CRAXDDT.ParameterFieldDefinition
Dim crpSections As CRAXDDT.Sections
Dim crpSection As CRAXDDT.Section
Dim crpReportObject As Object
Dim crpSubReportObject As CRAXDDT.SubreportObject
Dim crpSubReport As CRAXDDT.Report
Dim i As Integer
Dim iPosParam As Integer
Dim iPosParam2 As Integer
Dim rsAux As New ADODB.Recordset

On Error GoTo ManError
Screen.MousePointer = vbHourglass
Set mRPT = CreateObject("CrystalRuntime.Application")
Set mReport = mRPT.OpenReport(App.Path & "\Reportes\" & mpReportFileName)

' Especificar a que DB se va a conectar cada tabla del reporte
Set crpTables = mReport.Database.Tables

For i = 1 To crpTables.Count
Set crpTable = crpTables.Item(i)

crpTable.SetLogOnInfo "NOMBRE ODBC", , "Usuario", "PWD"
Next

' Verificar en todos los subreportes
Set crpSections = mReport.Sections

For Each crpSection In crpSections
For Each crpReportObject In crpSection.ReportObjects
If crpReportObject.Kind = crSubreportObject Then
Set crpSubReportObject = crpReportObject
Set crpSubReport = c