Problemas con el CRViewer1.ViewReport
Publicado por Jose Luis (1 intervención) el 28/12/2001 17:02:37
Tengo este fragmento de programa, que es el form donde tengo dos componentes. El CRViewer y un boton, fijense si me pueden ayudar, ya que me da un "error de automatizacion" cuando quiero visualizarlo :
Dim crxReporte As New CRAXDRT.Report
Dim crxAplicacion As New CRAXDRT.Application
Private Function AbreReporte() As Boolean
On Error GoTo errAbre
'Set crxReporte = crxAplicacion.OpenReport("j:\reportes\listadofamart.rpt")
AbreReporte = True
Exit Function
errAbre:
MsgBox Err.Number & " " & Err.Description, vbCritical, "Error"
AbreReporte = False
End Function
Private Sub Imprime_Nota()
On Error GoTo errImprimeN
'crxReporte.RecordSelectionFormula = "{Articulos.IdProveedor} = {?clave}"
'crxReporte.ParameterFields(1).AddCurrentValue (txtreferencia.Text)
'crxReporte.ReadRecords
CRViewer1.ReportSource = crxReporte
CRViewer1.ViewReport
Exit Sub
errImprimeN:
MsgBox Err.Number & " " & Err.Description, vbCritical, "clac clac"
End Sub
Private Sub Prepara_impresion()
Set crxAplicacion = Nothing
Set crxReporte = Nothing
CRViewer1.ReportSource = crxReporte
If Not AbreReporte Then Exit Sub
Imprime_Nota
Set crxAplicacion = Nothing
Set crxReporte = Nothing
End Sub
Private Sub Command1_Click()
Call Prepara_impresion
End Sub
Dim crxReporte As New CRAXDRT.Report
Dim crxAplicacion As New CRAXDRT.Application
Private Function AbreReporte() As Boolean
On Error GoTo errAbre
'Set crxReporte = crxAplicacion.OpenReport("j:\reportes\listadofamart.rpt")
AbreReporte = True
Exit Function
errAbre:
MsgBox Err.Number & " " & Err.Description, vbCritical, "Error"
AbreReporte = False
End Function
Private Sub Imprime_Nota()
On Error GoTo errImprimeN
'crxReporte.RecordSelectionFormula = "{Articulos.IdProveedor} = {?clave}"
'crxReporte.ParameterFields(1).AddCurrentValue (txtreferencia.Text)
'crxReporte.ReadRecords
CRViewer1.ReportSource = crxReporte
CRViewer1.ViewReport
Exit Sub
errImprimeN:
MsgBox Err.Number & " " & Err.Description, vbCritical, "clac clac"
End Sub
Private Sub Prepara_impresion()
Set crxAplicacion = Nothing
Set crxReporte = Nothing
CRViewer1.ReportSource = crxReporte
If Not AbreReporte Then Exit Sub
Imprime_Nota
Set crxAplicacion = Nothing
Set crxReporte = Nothing
End Sub
Private Sub Command1_Click()
Call Prepara_impresion
End Sub
Valora esta pregunta


0