Crystal Report - Como anular ventana toma datos Campos Parámetro

 
Vista:

Como anular ventana toma datos Campos Parámetro

Publicado por Antonio (13 intervenciones) el 03/03/2010 22:38:07
Cuando se crea en CR11.5 un Campo de Parámetro, al ejecutar desde VB6 el informe .rpt donde está dicho Campo de Parámetro, antes de aparecer el informe propiamente dicho, aparece una ventana titulada “Introducir Valores” para reseñar el valor que queremos pasarle al Campo de Parámetro.

¿Qué hay que hacer para que no aparezca dicha ventana, a fin de pasar el valor para el Campo de Parámetro (en mi caso lo he llamado Prueba) por código VB6 desde la form que llama al informe .rpt?

El código que tengo en dicha form es:

Private Sub Form_Load()
Dim crParamDefs As CRAXDDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDDRT.ParameterFieldDefinition

On Error GoTo ErrHandler

Screen.MousePointer = vbHourglass

mflgContinuar = True

Set rsPed = New ADODB.Recordset
strSQL = "SELECT * FROM PedidSEA WHERE Numero = '" & TBcNumPed & "'"
rsPed.Open strSQL, g_db, adOpenDynamic, adLockOptimistic

Set crReport = objApp.OpenReport(App.Path & "\A4LiPeSEA.rpt", 1)

Set crParamDefs = crReport.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "Prueba"
crParamDef.AddCurrentValue (TBcNumPed)
End Select
Next

With crReport
.Database.SetDataSource rsPed
.PaperOrientation = 1
.PaperSize = 0
.DiscardSavedData
End With

With crViewer1
.ReportSource = crReport
.ViewReport
.Zoom (95)
End With

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_Unload(Cancel As Integer)
Set crReport = Nothing
Set objApp = Nothing
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:Como anular ventana toma datos Campos Parámetro

Publicado por Antonio (13 intervenciones) el 04/03/2010 22:20:31
Solucionado por un amigo, que me dijo:

"Yo los inserto en el vb a lo mejor crece un poco el ejecutable pero te evitas algunos problemas...
De hecho si ya tienes el reporte para insertarlo en vb agregas la referencia, luego como si agregaras un modulo pero seleccionas Crystal Report 10 y le dices archivo existente, despues te pregunta que si deseas utilizar el crViewer le dices que si, luego te pregunta que si lo dejas como principal le dices que no y listo,te paso 2 codigos uno con el que llamo al reporte que es parecido al tuyo y otro lo que tiene el crViewer."

Saludos cordiales.
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