SelectionFormula con valores de Listbox
Publicado por Dario Ramallo. (3 intervenciones) el 13/01/2009 02:49:31
Hola a todos,
Estoy necesitando que me ayuden, estoy realizando una aplicacion con vb 6 y crystal report 8, lo que necesito hacer es lo siguiente, pasarle a un selectionformula los datos seleccionados de un listbox con checked, este es el codigo que estoy implementando, pero me da un error.
Private Sub Controles()
Dim i As Integer
Dim SelectItems As String
With CRNivel
.ReportFileName = App.Path & "ReportesNivelEducativo.rpt"
For i = 0 To lstNivel.ListCount - 1
If lstNivel.Selected(i) = True Then
SelectItems = SelectItems & "'" & Trim(lstNivel.ItemData(i)) & "',"
End If
Next i
If Len(SelectItems) > 0 Then
SelectItems = Left(SelectItems, Len(SelectItems) - 1)
End If
.SelectionFormula = "{EstudioCursado.CodEstudioCursado} IN [" & SelectItems & "]"
If Control = True Then
.Destination = crptToWindow
Else
.Destination = crptToPrinter
End If
.WindowState = crptMaximized
.WindowShowZoomCtl = True
.Action = 1
End With
End Sub
Espero que me comprendan y desde ya MUCHAS GRACIAS...
Dario Ramallo.
Estoy necesitando que me ayuden, estoy realizando una aplicacion con vb 6 y crystal report 8, lo que necesito hacer es lo siguiente, pasarle a un selectionformula los datos seleccionados de un listbox con checked, este es el codigo que estoy implementando, pero me da un error.
Private Sub Controles()
Dim i As Integer
Dim SelectItems As String
With CRNivel
.ReportFileName = App.Path & "ReportesNivelEducativo.rpt"
For i = 0 To lstNivel.ListCount - 1
If lstNivel.Selected(i) = True Then
SelectItems = SelectItems & "'" & Trim(lstNivel.ItemData(i)) & "',"
End If
Next i
If Len(SelectItems) > 0 Then
SelectItems = Left(SelectItems, Len(SelectItems) - 1)
End If
.SelectionFormula = "{EstudioCursado.CodEstudioCursado} IN [" & SelectItems & "]"
If Control = True Then
.Destination = crptToWindow
Else
.Destination = crptToPrinter
End If
.WindowState = crptMaximized
.WindowShowZoomCtl = True
.Action = 1
End With
End Sub
Espero que me comprendan y desde ya MUCHAS GRACIAS...
Dario Ramallo.
Valora esta pregunta


0