Crystal Report - Pasar Parametros en crystal report 8.5

 
Vista:

Pasar Parametros en crystal report 8.5

Publicado por beto (1 intervención) el 26/09/2006 18:21:02
hola necesito ayuda urgente y la eh buscado espero me puedan ayudar...necesito pasar 2 parametros a mi reporte cr8.5 q funciona correctamente en cr pero cuando lo envio de vb6 me sale el reporte en blanco supongo q no recibe los parametros este es el codigo q utilice (utilizo el crviewer) si me pueden ayudar mandenmelo a este msn [email protected]

=====boton===============

On Error GoTo P:
Dim col As Collection
FECHAINI = Format(DTFECHAINI.Value, "DD/MM/YYYY")
FECHAFIN = Format(DTFECHAFIN.Value, "DD/MM/YYYY")
Set col = New Collection
col.Add FECHAINI, "FECHAINI"
col.Add FECHAFIN, "FECHAFIN"

Dim frmRpt As frmReportes
DoEvents
Set frmRpt = New frmReportes
frmRpt.Tag = "LISTADO DE RANKING DE VENTAS"
DoEvents
frmRpt.CargaReporte App.Path & "\Reportes\RPT_RANKING_VENTAS.rpt", col
P:
If err.Number = 0 Then
Else
MsgBox err.Description, vbCritical, Me.Caption
End If

===frmReportes====================

Option Explicit

Public Sub CargaReporte(ByVal ReportFileName As String, ByVal Parameters As Collection)
On Error GoTo err:
Dim crApp As CRAXDRT.Application
Dim crRept As CRAXDRT.Report
Dim crDBTab As CRAXDRT.DatabaseTable
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim X As Integer

Set crApp = New CRAXDRT.Application
Set crRept = crApp.OpenReport(ReportFileName)

crRept.EnableParameterPrompting = False
crRept.DiscardSavedData 'ESTA LINEA ES PARA ACTUALIZAR LOS DATOS DEL REPORTE

' crRept.Database.LogOnServer "p2sodbc.dll", "(local)", "CALVORS", "sa", ""


Set crParamDefs = crRept.ParameterFields

' Loop through all parameters in the report by name, filling in the appropriate parameter with the right value
X = 1
On Error Resume Next
For Each crParamDef In crParamDefs
'Aqui detectamos si en el objeto collection Parameters existe el parámetro o no
Parameters (crParamDef.ParameterFieldName)
If err.Number = 0 Then
crParamDef.SetCurrentValue Parameters(crParamDef.ParameterFieldName)
End If
Next
On Error GoTo 0

'**********ver
Me.Caption = IIf(Len(Me.Tag) > 0, Me.Tag, crRept.ReportTitle)
' CRViewer1.Refresh

CRViewer1.ReportSource = crRept

crRept.VerifyOnEveryPrint = True

CRViewer1.DisplayGroupTree = False
CRViewer1.EnableExportButton = True

CRViewer1.ViewReport

CRViewer1.Zoom 110
Exit Sub
err:
MsgBox err.Description, vbCritical, "Error..."
End Sub
Private Sub cmdExit_Click()
If Not CRViewer1.IsBusy Then
Unload Me
End If
End Sub

Private Sub CRViewer1_CloseButtonClicked(UseDefault As Boolean)
CRViewer1.PrintReport
End Sub

Private Sub Form_Activate()
FRMCERO Me
End Sub

Private Sub Form_Load()
CRViewer1.EnableRefreshButton = False
End Sub

Private Sub Form_Resize()
On Error Resume Next
CRViewer1.Height = Me.Height
CRViewer1.Width = Me.Width
cmdExit.Move Me.ScaleWidth - cmdExit.Width - 430

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Pasar Parametros en crystal report 8.5

Publicado por Ricardo Sierra (133 intervenciones) el 26/09/2006 23:21:39
Envia los parametros en formato ANSI

... = FORMAT(Fecha, "yyyy-MM-dd")
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Pasar Parametros en crystal report 8.5

Publicado por petis (1 intervención) el 17/01/2007 09:47:57
Te falta indicarle dónde está la base de datos a la que enlaza el informe.

Dim tbl As CRAXDRT.DatabaseTable

For Each tbl In Report.Database.Tables
tbl.SetLogOnInfo NombreBaseDatos
Next
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Pasar Parametros en crystal report 8.5

Publicado por RENZO (4 intervenciones) el 19/05/2007 19:13:12
Option Explicit
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 mstrParametro3 As String

Private Sub Form_Activate()
If Not mflgContinuar Then Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo Error
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition

'Abrir el reporte

Screen.MousePointer = vbHourglass
mflgContinuar = True

Set crReport = crApp.OpenReport("C:\SYCOAL\Reportes\RptKardexCantidadesInt.rpt", 0)

' Parametros del reporte
Set crParamDefs = crReport.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "@Fecha1"
crParamDef.AddCurrentValue (mstrParametro1)
Case "@Fecha2"
crParamDef.AddCurrentValue (mstrParametro2)
Case "@CodConcatArt"
crParamDef.AddCurrentValue (mstrParametro3)
End Select
Next

crReport.Database.Tables(1).SetLogOnInfo SERVIDOR, "DATASYCOAL", "sa", "sa"

CRViewer.ReportSource = crReport
' CRViewer.DisplayGroupTree = True
CRViewer.ViewReport
Screen.MousePointer = vbDefault
Set crParamDefs = Nothing
Set crParamDef = Nothing
Exit Sub
Error:
If Err.Number = -2147206461 Then
Informacion ("El archivo de reporte no se encuentra, restáurelo de los discos de instalación")
Else
Informacion (Err.Description)
End If
mflgContinuar = False
Screen.MousePointer = vbDefault
End Sub

Private Sub Form_Resize()
CRViewer.Top = 0
CRViewer.Left = 0
CRViewer.Height = ScaleHeight
CRViewer.Width = ScaleWidth
End Sub

Public Sub PasarParametros(Param1 As String, Param2 As String, Param3 As String)
mstrParametro1 = Param1
mstrParametro2 = Param2
mstrParametro3 = Param3

End Sub

Private Sub Form_Unload(Cancel As Integer)
Set crReport = Nothing
Set crApp = Nothing
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Pasar Parametros en crystal report 8.5

Publicado por Miriam (1 intervención) el 08/08/2007 22:35:11
Hola que tal, espero el siguiente link te solucione el problema, porque ami si me lo soluciono...

http://www.elguille.info/vb/crystal/crystalDanielMaya.htm
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar