Problemas con Crystal Report 5 y VB 6
Publicado por Alejandro Rafael Cruz (1 intervención) el 15/08/2007 22:58:57
Estimados colegas, tengo un problema con el VB 6 Crystal Report 5, al tiempo de ejecucion de da el erro 20536 y 20530, ahora he buscado en diferentes lados de la Web y he hecho lo que dicen pero no consigo que funcione, este es el codigo que ocupo para llamar el reporte:
Private Sub BotonImprimir_Click()
Dim cFormula As String
On Error GoTo Errores
Screen.MousePointer = CursorArena
FReportes.ReporteCatálogo.DataFiles(0) = RutaBaseDatos
'Archivo a Imprimir
FReportes.ReporteCatálogo.ReportFileName = RutaReporte + "KArts01.rpt"
'Destino y no. de Copias
FReportes.ReporteCatálogo.Destination = IIf(DImpresora.Value, 1, 0)
FReportes.ReporteCatálogo.CopiesToPrinter = IIf(IsNumeric(NumCopias.Text), NumCopias.Text, 1)
'Tamaño de la Pantalla
FReportes.ReporteCatálogo.WindowTop = -6
FReportes.ReporteCatálogo.WindowLeft = -6
FReportes.ReporteCatálogo.WindowHeight = Screen.Height
FReportes.ReporteCatálogo.WindowWidth = Screen.Width
'Orden del Reporte
Select Case ArchivoPrint
Case "KArts01.rpt"
If ONumerico.Value Then
FReportes.ReporteCatálogo.SortFields(0) = "+{Articulos.CveArticulo}"
ElseIf OAlfabetico.Value Then
FReportes.ReporteCatálogo.SortFields(0) = "+{Articulos.Descripcion}"
FReportes.ReporteCatálogo.SortFields(1) = "+{Articulos.CveArticulo}"
End If
End Select
' Seleccionar Registros en el Reporte
cFormula = cFormula + IIf(chkClave.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.CveArticulo} >= '" & txtCveIni.Text & "' And {Articulos.CveArticulo} <= '" & txtCveFin.Text & "'", "")
cFormula = cFormula + IIf(chkLinea.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.Linea} >= '" & txtLineaIni.Text & "' And {Articulos.Linea} <= '" & txtLineaFin.Text & "'", "")
' Validar fecha que no este vacia, ya que entra de todos modos en el proceso del iif
If chkFUCompra.Value Then
cFormula = cFormula & IIf(cFormula = "", "", " And ") & "{Articulos.FechaUltimaCompra} >= " & rptFecha(maskFechaUCIni.Text) & " And {Articulos.FechaUltimaCompra} <= " & rptFecha(maskFechaUCFin.Text)
Else
cFormula = cFormula & ""
End If
' Validar fecha que no este vacia, ya que entra de todos modos en el proceso del iif
If chkFUVenta.Value Then
cFormula = cFormula & IIf(cFormula = "", "", " And ") & "{Articulos.FechaUltimaVenta} >= " & rptFecha(maskFechaUVIni.Text) & " And {Articulos.FechaUltimaVenta} <= " & rptFecha(maskFechaUVFin.Text)
Else
cFormula = cFormula & ""
End If
'
cFormula = cFormula + IIf(chkPrecio.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.PrecioPublico} >= " & txtPrecioIni.Text & " And {Articulos.PrecioPublico} <= " & txtPrecioFin.Text, "")
cFormula = cFormula + IIf(chkCosto.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.UltimoCosto} >= " & txtCostoIni.Text & " And {Articulos.UltimoCosto} <= " & txtCostoFin.Text, "")
' Aplicar Formula
FReportes.ReporteCatálogo.SelectionFormula = cFormula + " "
Unload Me
Screen.MousePointer = CursorArena
If bNombreParametrizado = True Then
FReportes.ReporteCatálogo.formulas(0) = "EmpActiva = '" & cCveOficinaNombre & "'"
End If
FReportes.ReporteCatálogo.Action = 1
Screen.MousePointer = CursorNormal
Exit Sub
' Seccion de Errores
Errores:
Select Case Err.Number
Case 20504, 20507 'Reporte Inexistente, Archivo Invalido
MsgBox "Causa: El Reporte no Existe. Ha sido eliminado o Cambiado de Directorio", 16, "Error"
Case 20512, 20517, 20520 'Problemas con la impresora
MsgBox "Causa: Problemas con la Impresora (Cheque cables, conexión o encendido).", 16, "Error"
Case 20526 'No hay Impresora por Default
MsgBox "Causa: No ha especificado la Impresora (Utilice el Panel de Control para Hacerlo).", 16, "Error"
Case Else
If MsgBox(Err.Description & " " & Err.Number, 5 + 32 + 256, "Error que Debe Comunicar a Informática.") = 2 Then
End ' Terminar Programa
End If
End Select
Salir:
Screen.MousePointer = CursorNormal
End Sub
Si alguno de ustedes me puede ayudar y decirme que estoy haciendo mal se los voy a agradecer.
De antemano muchas gracias por su tiempo.
Alejandro Rafael Cruz.
Saludos.
Private Sub BotonImprimir_Click()
Dim cFormula As String
On Error GoTo Errores
Screen.MousePointer = CursorArena
FReportes.ReporteCatálogo.DataFiles(0) = RutaBaseDatos
'Archivo a Imprimir
FReportes.ReporteCatálogo.ReportFileName = RutaReporte + "KArts01.rpt"
'Destino y no. de Copias
FReportes.ReporteCatálogo.Destination = IIf(DImpresora.Value, 1, 0)
FReportes.ReporteCatálogo.CopiesToPrinter = IIf(IsNumeric(NumCopias.Text), NumCopias.Text, 1)
'Tamaño de la Pantalla
FReportes.ReporteCatálogo.WindowTop = -6
FReportes.ReporteCatálogo.WindowLeft = -6
FReportes.ReporteCatálogo.WindowHeight = Screen.Height
FReportes.ReporteCatálogo.WindowWidth = Screen.Width
'Orden del Reporte
Select Case ArchivoPrint
Case "KArts01.rpt"
If ONumerico.Value Then
FReportes.ReporteCatálogo.SortFields(0) = "+{Articulos.CveArticulo}"
ElseIf OAlfabetico.Value Then
FReportes.ReporteCatálogo.SortFields(0) = "+{Articulos.Descripcion}"
FReportes.ReporteCatálogo.SortFields(1) = "+{Articulos.CveArticulo}"
End If
End Select
' Seleccionar Registros en el Reporte
cFormula = cFormula + IIf(chkClave.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.CveArticulo} >= '" & txtCveIni.Text & "' And {Articulos.CveArticulo} <= '" & txtCveFin.Text & "'", "")
cFormula = cFormula + IIf(chkLinea.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.Linea} >= '" & txtLineaIni.Text & "' And {Articulos.Linea} <= '" & txtLineaFin.Text & "'", "")
' Validar fecha que no este vacia, ya que entra de todos modos en el proceso del iif
If chkFUCompra.Value Then
cFormula = cFormula & IIf(cFormula = "", "", " And ") & "{Articulos.FechaUltimaCompra} >= " & rptFecha(maskFechaUCIni.Text) & " And {Articulos.FechaUltimaCompra} <= " & rptFecha(maskFechaUCFin.Text)
Else
cFormula = cFormula & ""
End If
' Validar fecha que no este vacia, ya que entra de todos modos en el proceso del iif
If chkFUVenta.Value Then
cFormula = cFormula & IIf(cFormula = "", "", " And ") & "{Articulos.FechaUltimaVenta} >= " & rptFecha(maskFechaUVIni.Text) & " And {Articulos.FechaUltimaVenta} <= " & rptFecha(maskFechaUVFin.Text)
Else
cFormula = cFormula & ""
End If
'
cFormula = cFormula + IIf(chkPrecio.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.PrecioPublico} >= " & txtPrecioIni.Text & " And {Articulos.PrecioPublico} <= " & txtPrecioFin.Text, "")
cFormula = cFormula + IIf(chkCosto.Value, _
IIf(cFormula = "", "", " And ") & "{Articulos.UltimoCosto} >= " & txtCostoIni.Text & " And {Articulos.UltimoCosto} <= " & txtCostoFin.Text, "")
' Aplicar Formula
FReportes.ReporteCatálogo.SelectionFormula = cFormula + " "
Unload Me
Screen.MousePointer = CursorArena
If bNombreParametrizado = True Then
FReportes.ReporteCatálogo.formulas(0) = "EmpActiva = '" & cCveOficinaNombre & "'"
End If
FReportes.ReporteCatálogo.Action = 1
Screen.MousePointer = CursorNormal
Exit Sub
' Seccion de Errores
Errores:
Select Case Err.Number
Case 20504, 20507 'Reporte Inexistente, Archivo Invalido
MsgBox "Causa: El Reporte no Existe. Ha sido eliminado o Cambiado de Directorio", 16, "Error"
Case 20512, 20517, 20520 'Problemas con la impresora
MsgBox "Causa: Problemas con la Impresora (Cheque cables, conexión o encendido).", 16, "Error"
Case 20526 'No hay Impresora por Default
MsgBox "Causa: No ha especificado la Impresora (Utilice el Panel de Control para Hacerlo).", 16, "Error"
Case Else
If MsgBox(Err.Description & " " & Err.Number, 5 + 32 + 256, "Error que Debe Comunicar a Informática.") = 2 Then
End ' Terminar Programa
End If
End Select
Salir:
Screen.MousePointer = CursorNormal
End Sub
Si alguno de ustedes me puede ayudar y decirme que estoy haciendo mal se los voy a agradecer.
De antemano muchas gracias por su tiempo.
Alejandro Rafael Cruz.
Saludos.
Valora esta pregunta


0