`codigo crytal reports Public Sub Presentar_Informe(ByVal

Anuncio
'codigo crytal reports
Public Sub Presentar_Informe(ByVal sTituloReporte As String, ByVal sNombreReporte As
String, ByVal sSQLWhere As String, ByVal conexion As String, Optional nDataFile = 0, Optional
sVista = "")
On Error GoTo Error_Listado
'En frmMenu es donde tengo insertado el control del Crystal Report
Menu.CrystalReport1.Connect = conexion
Menu.CrystalReport1.ReportFileName = sNombreReporte
Menu.CrystalReport1.WindowTitle = sTituloReporte
Menu.CrystalReport1.ReportTitle = sTituloReporte
' Menu.CrystalReport1.SelectionFormula = sSQLWhere
Menu.CrystalReport1.SQLQuery = sSQLWhere
If sVista <> "" Then
Menu.CrystalReport1.DataFiles(nDataFile) = sVista
End If
Menu.CrystalReport1.ProgressDialog = True
Menu.CrystalReport1.Destination = crptToWindow
Menu.CrystalReport1.WindowState = crptMaximized
Menu.CrystalReport1.Action = 1
Menu.CrystalReport1.PageZoom (75)
Exit Sub
Error_Listado:
If Err.Number = 20534 Or Err.Number = 0 Then
MsgBox Err.Description, vbOKOnly, "Error"
'Menu.Adodc1.Recordset.Close
Menu.CrystalReport1.Connect = ""
Resume Next
End If
MsgBox Err.Description & Err.Number
End Sub
Public Sub initCrystalControl(crpReport As CrystalReport)
Dim i As Integer
On Error Resume Next
crpReport.Connect = ""
crpReport.ReportFileName = ""
crpReport.SelectionFormula = ""
For i = 0 To 49
crpReport.Formulas(i) = ""
crpReport.SortFields(i) = ""
crpReport.DataFiles(i) = ""
crpReport.StoredProcParam(i) = ""
Next i
End Sub
Descargar