Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/02/2008, 20:04
Avatar de Darth_Sith
Darth_Sith
 
Fecha de Ingreso: mayo-2007
Ubicación: Esperando noticias......
Mensajes: 1
Antigüedad: 17 años, 11 meses
Puntos: 0
Re: Crystal Report y VB 6

Hola estimada.
La verdad es que en mi caso me paso casi igual a ti. Me puse a buscar en la matriz y encontré esto y lo adapte ami código.

Adaptarlo a tus requisitos y listo reina.

'Abrir el reporte
Screen.MousePointer = vbHourglass
Set CnnSql = Nothing
Set CnnSql = New ADODB.Connection
CnnSql.ConnectionTimeout = 1024
CnnSql.CommandTimeout = 1024
CnnSql.Open "dsn=tu_dsn;uid=tsuario;pwd=tu_password;"
SQL = " Tu_query_sql"
DoEvents
Set tRs = New Recordset
tRs.Open SQL, CnnSql, adOpenDynamic, adLockOptimistic
DoEvents


CRViewer.DisplayBorder = False 'MAKES REPORT FILL ENTIRE FORM
CRViewer.DisplayTabs = False 'THIS REPORT DOES NOT DRILL DOWN, NOT NEEDED
CRViewer.EnableDrillDown = False 'REPORT DOES NOT SUPPORT DRILL-DOWN
CRViewer.EnableRefreshButton = False 'ADO RECORDSET WILL NOT CHANGE, NOT NEEDED
CRViewer.DisplayGroupTree = False

Set Crystal = New CRAXDRT.Application 'MANAGES REPORTS

Set Report = Crystal.OpenReport(App.Path & "\tu_reports.rpt") 'OPEN OUR REPORT

Report.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM RECORDSET
Report.Database.SetDataSource tRs 'LINK REPORT TO RECORDSET
CRViewer.ReportSource = Report 'LINK VIEWER TO REPORT
CRViewer.ViewReport 'SHOW REPORT

Do While CRViewer.IsBusy 'ZOOM METHOD DOES NOT WORK WHILE
DoEvents 'REPORT IS LOADING, SO WE MUST PAUSE
Loop 'WHILE REPORT LOADS.
CRViewer.Zoom 80

tRs.Close 'ALL BELOW HERE IS CLEANUP
Set rs = Nothing

CnnSql.Close
Set CnnSql = Nothing

Set Crystal = Nothing
Set Report = Nothing
Screen.MousePointer = vbDefault

Espero te sirva de algo.

Yo lo adapte de un mysql a crystal reports con visual basic.

Un beso suerte.