Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/06/2006, 05:30
Insomnia
 
Fecha de Ingreso: noviembre-2005
Mensajes: 751
Antigüedad: 18 años, 6 meses
Puntos: 13
Hola

Para enlazar los informes de Crystal 10 con VB6, yo agrego el componente Crystal ActiveX Report Viewer, ademas de las referencias Crystal Report ActiveX Designer Desingn and Runtime y Crystal Report ActiveX Designer Run Time.

Inserto un nuevo formulario y lo lleno con el control Report Viewer. En ese formulario declaro las siguientes variables:

Código:
Dim bd As New ADODB.Connection
Dim RegInfo As New ADODB.Recordset
Dim CrxInfor As CRAXDRT.Report
Dim CrxApp As New CRAXDRT.Application
En el formLoad pongo lo siguiente:
Código:
    bd.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NombreBD;Data Source=ServidorSQL"
    
    RegInfo.Open "SELECT nomcurso, descrip, matcurso from curso", bd, adOpenDynamic, adLockReadOnly
    Screen.MousePointer = 11
    
    Set CrxInfor = CrxApp.OpenReport(App.Path & "\informes\cursos.rpt")
    
    CrxInfor.DiscardSavedData
    CrxInfor.Database.SetDataSource RegInfo
    
    With CrystalActiveXReportViewer1
        .ReportSource = CrxInfor
        .EnableExportButton = True
        .DisplayGroupTree = False
        .EnablePopupMenu = False
        .EnableDrillDown = False
        .EnableSelectExpertButton = False
        .ViewReport
        .Zoom 100
    End With
    
    Screen.MousePointer = 0
La conexión a la bd dependera con que trabajas y el informe yo lo realizo con archivos TTX. Espero que te resulte util.

--Saludos--