giannicotina
04-20-2004, 06:24 PM
Hi,
i'm having a strange problem when using CR8.0 with my vb6 application.
I'm using this code in vb to dinamically change a template report that i made:
Public Sub dynamicCrystal6(dbName As String)
sSQL2 = "Select * From usuarios_grupos where GRUPOTEXTO='" & grupo & "' "
Set RS2 = m_cn.Execute(sSQL2)
grupo = RS2("grupotexto")
periodoant = RS2("periodoactual") - 1
periodoact = RS2("periodoactual")
If periodoant = 0 Then
'MsgBox "El grupo de trabajo se encuentra en el periodo 1.No existen informes de niveles de riesgo de periodos anteriores."
NoInformes.Show
PicOutput.Visible = False
Else
SWFImprimir.Visible = True
PicOutput.Visible = True
Set RS = New ADODB.Recordset
sSQL = "Select * From Historico3_" & grupo & " where USUARIO='" & usuario_report & "'"
Set RS = m_cn.Execute(sSQL)
Set crxRpt = crxApp.OpenReport(App.Path & "\report\Report6v2.rpt", 1)
For Each crxTable In crxRpt.Database.Tables
crxTable.Location = dbName
Next
crxRpt.DiscardSavedData
crxRpt.Database.SetDataSource RS
Set crParamDefs = crxRpt.ParameterFields
crxRpt.EnableParameterPrompting = False
For Each crParamDef In crParamDefs
With crParamDef
Select Case .ParameterFieldName
Case "periodoact"
.ClearCurrentValueAndRange
.SetCurrentValue periodoact
Case "usuarioactual"
.ClearCurrentValueAndRange
.SetCurrentValue usuario_report
Case "grupoactual"
.ClearCurrentValueAndRange
.SetCurrentValue grupo
End Select
End With
Next
If imprimir = False Then
CRViewer1.ReportSource = crxRpt
CRViewer1.ViewReport
CRViewer1.Zoom (85)
ElseIf imprimir = True Then
crxRpt.PrintOut
End If
imprimir = False
End If
End Sub
In the report i have 14 fields coming from a database table that has exactly the same structure as
Historico3_" & grupo & "
(so i just change the origin of data)
My problem is that i just get 13 results shown in the final report (with the first one not showing and the others showing in wrong place, actually, in the place before where they should be)
What's wrong??
Thanks!
PS: all database fields have data in them
i'm having a strange problem when using CR8.0 with my vb6 application.
I'm using this code in vb to dinamically change a template report that i made:
Public Sub dynamicCrystal6(dbName As String)
sSQL2 = "Select * From usuarios_grupos where GRUPOTEXTO='" & grupo & "' "
Set RS2 = m_cn.Execute(sSQL2)
grupo = RS2("grupotexto")
periodoant = RS2("periodoactual") - 1
periodoact = RS2("periodoactual")
If periodoant = 0 Then
'MsgBox "El grupo de trabajo se encuentra en el periodo 1.No existen informes de niveles de riesgo de periodos anteriores."
NoInformes.Show
PicOutput.Visible = False
Else
SWFImprimir.Visible = True
PicOutput.Visible = True
Set RS = New ADODB.Recordset
sSQL = "Select * From Historico3_" & grupo & " where USUARIO='" & usuario_report & "'"
Set RS = m_cn.Execute(sSQL)
Set crxRpt = crxApp.OpenReport(App.Path & "\report\Report6v2.rpt", 1)
For Each crxTable In crxRpt.Database.Tables
crxTable.Location = dbName
Next
crxRpt.DiscardSavedData
crxRpt.Database.SetDataSource RS
Set crParamDefs = crxRpt.ParameterFields
crxRpt.EnableParameterPrompting = False
For Each crParamDef In crParamDefs
With crParamDef
Select Case .ParameterFieldName
Case "periodoact"
.ClearCurrentValueAndRange
.SetCurrentValue periodoact
Case "usuarioactual"
.ClearCurrentValueAndRange
.SetCurrentValue usuario_report
Case "grupoactual"
.ClearCurrentValueAndRange
.SetCurrentValue grupo
End Select
End With
Next
If imprimir = False Then
CRViewer1.ReportSource = crxRpt
CRViewer1.ViewReport
CRViewer1.Zoom (85)
ElseIf imprimir = True Then
crxRpt.PrintOut
End If
imprimir = False
End If
End Sub
In the report i have 14 fields coming from a database table that has exactly the same structure as
Historico3_" & grupo & "
(so i just change the origin of data)
My problem is that i just get 13 results shown in the final report (with the first one not showing and the others showing in wrong place, actually, in the place before where they should be)
What's wrong??
Thanks!
PS: all database fields have data in them