Skip to Content
0
May 10, 2020 at 07:18 AM

crystal report without database vb 6.0

93 Views Last edit May 11, 2020 at 12:52 PM 2 rev

Possible to create a report only with this recordset
...
Call GetListViewData(ListView1)
....

Private Sub GetListViewData(lv As ListView)

    Dim I As Integer

    Set RSTEST = New ADODB.Recordset
    With RSTEST.Fields
        .Append "Field1", adBSTR
        .Append "Field2", adBSTR
        .Append "Field3", adBSTR
        .Append "Field4", adBSTR
        .Append "Field5", adBSTR
        .Append "Field6", adBSTR
    End With

    RSTEST.Open
    For I = 1 To lv.ListItems.Count
        With RSTEST
            .AddNew
            .Fields("Field1") = lv.ListItems(I).Text
            .Fields("Field2") = lv.ListItems(I).SubItems(1)
            .Fields("Field3") = lv.ListItems(I).SubItems(2)
            .Fields("Field4") = lv.ListItems(I).SubItems(3)
            .Fields("Field5") = lv.ListItems(I).SubItems(4)
            .Fields("Field6") = lv.ListItems(I).SubItems(5)
            .Update
        End With
    Next I

End Sub