Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/07/2006, 12:40
ci2000
 
Fecha de Ingreso: abril-2005
Mensajes: 483
Antigüedad: 20 años
Puntos: 3
Hola, te paso un ejemplo que dió Insomnia.

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:
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:
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