Hola a todos, estoy haciendo un reporte en crystal report 9 pero a la hora de llamar al reporte solo me biene con las cabeceras sin datos. También me he dado cuenta que no entra al For.
Private crApp As New CRAXDRT.APPLICATION
Private crReport As New CRAXDRT.Report
Private mflgContinuar As Boolean
Private mstrParametro1 As String
Private mstrParametro2 As String
Private Sub Form_Activate()
If Not mflgContinuar Then Unload Me
End Sub
Private Sub Form_Load()
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim SelectFormula As String
On Error GoTo ErrHandler
'Abrir el reporte
Screen.MousePointer = vbHourglass
mflgContinuar = True
Set crReport = crApp.OpenReport(App.Path & "\Reportes\Ingreso de Equipos.rpt", 1)
crReport.RecordSelectionFormula = "{RecepcionEquipos.fechaIngreso}>=#" & mstrParametro1 & "# AND {RecepcionEquipos.fechaIngreso}<=#" & mstrParametro2 & "#"
'Parametros del reporte
Set crParamDefs = crReport.ParameterFields
For Each crParamDef In crParamDefs ==> NO ENTRA A ESTE BUCLE
Select Case crParamDef.ParameterFieldName
Case "Parametro1"
crParamDef.AddCurrentValue (mstrParametro1)
Case "Parametro2"
crParamDef.AddCurrentValue (mstrParametro2)
End Select
Next
CRViewer1.ReportSource = crReport
CRViewer1.DisplayGroupTree = False
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
Set crParamDefs = Nothing
Set crParamDef = Nothing
Exit Sub
ErrHandler:
If Err.Number = -2147206461 Then
MsgBox "El archivo de reporte no se encuentra, restáurelo de los discos de instalación", _
vbCritical + vbOKOnly
Else
MsgBox Err.Description, vbCritical + vbOKOnly
End If
mflgContinuar = False
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
Public Sub PasarParametros(sParam1 As String, sParam2 As String)
mstrParametro1 = sParam1
mstrParametro2 = sParam2
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set crReport = Nothing
Set crApp = Nothing
End Sub
Pedro Avila
Nota: Estoy usando Access