Hi all..
How i can make a report without using database.
Data can directly from the active form.

Thank you in advance

Sal_1 commented: Have you resolved with listview and crystal report? If Yes can you send me a complete project, please. gss.italy(@).iol.it +0

Recommended Answers

See if this helps :
[CODE]Set rsTest = New ADODB.Recordset

With
.Append "Field1", adBSTR
.Append "Field2", adBSTR
.Append "Field3", adBSTR
End With

rsTest.Open

With rsTest
.AddNew
.Fields("Field1") = "Test1"
.Fields("Field2") = "Test2"
.Fields("Field3") = "Test3"
.Update
End With
Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"

Jump to Post

All 6 Replies

Re: Make report without database 80 80

Create a recordset to Accomodate related item then set datareport recordset to it.

Re: Make report without database 80 80

Thanks for your reply Jx_Man.
Can you assist me. I never doing this before.

Re: Make report without database 80 80

See if this helps :

Set rsTest = New ADODB.Recordset

With
.Append "Field1", adBSTR
.Append "Field2", adBSTR
.Append "Field3", adBSTR
End With

rsTest.Open

With rsTest
.AddNew
.Fields("Field1") = "Test1"
.Fields("Field2") = "Test2"
.Fields("Field3") = "Test3"
.Update
End With
Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
End With
DataReport1.Refresh
DataReport1.Show 1
End Sub
commented: This snippet realy help me. Thank you :) +3
Re: Make report without database 80 80

Hi all..
How i can make a report without using database.
Data can directly from the active form.

Thank you in advance

If the form has all the info for the report, just start outputting the info the way you want it.

If that doesn't help please give some details.

Re: Make report without database 80 80

Thank Jx_Man for the answer. That really help me.
This my code after trying your sample code :

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
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)
        .Update
    End With
Next i
   


Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
.Controls("Text4").DataField = "Field4"
End With
DataReport1.Refresh
DataReport1.Show 1
 
End Sub


Private Sub Command1_Click()
Call GetListViewData(ListView1)
End Sub

Private Sub Form_Load()
' Set listview
With ListView1
    .View = lvwReport
    .FullRowSelect = True
    .ColumnHeaders.Add , , "Id", 1100
    .ColumnHeaders.Add , , "First Name", 1400
    .ColumnHeaders.Add , , "Last Name", 1400
    .ColumnHeaders.Add , , "Email", 1700
End With

' Insert Data
With ListView1.ListItems
    .Add , , "1"
    .Item(1).SubItems(1) = "Andre"
    .Item(1).SubItems(2) = "White"
    .Item(1).SubItems(3) = "Andre@White.com"
    
    .Add , , "2"
    .Item(2).SubItems(1) = "Danny"
    .Item(2).SubItems(2) = "Burnett"
    .Item(2).SubItems(3) = "Danny@Burnett.com"
    
    .Add , , "3"
    .Item(3).SubItems(1) = "Edward"
    .Item(3).SubItems(2) = "Carter"
    .Item(3).SubItems(3) = "Edward@Carter.com"
    
    .Add , , "4"
    .Item(4).SubItems(1) = "Anne"
    .Item(4).SubItems(2) = "Witter"
    .Item(4).SubItems(3) = "Anne@Witter.com"
    
    .Add , , "5"
    .Item(5).SubItems(1) = "Vicky"
    .Item(5).SubItems(2) = "Myron"
    .Item(5).SubItems(3) = "Vicky@Myron.com"
End With
End Sub

Thank you again for helping.

commented: i have the same prob with listview. if you havr esolved can you send me your example project? tks +0
Re: Make report without database 80 80

hi guys ..
i need to use these Sample with ActiveReport how ... ?

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
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)
        .Update
    End With
Next i

Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
.Controls("Text4").DataField = "Field4"
End With
DataReport1.Refresh
DataReport1.Show 1

End Sub
Private Sub Command1_Click()
Call GetListViewData(ListView1)
End Sub
Private Sub Form_Load()
' Set listview
With ListView1
    .View = lvwReport
    .FullRowSelect = True
    .ColumnHeaders.Add , , "Id", 1100
    .ColumnHeaders.Add , , "First Name", 1400
    .ColumnHeaders.Add , , "Last Name", 1400
    .ColumnHeaders.Add , , "Email", 1700
End With
' Insert Data
With ListView1.ListItems
    .Add , , "1"
    .Item(1).SubItems(1) = "Andre"
    .Item(1).SubItems(2) = "White"
    .Item(1).SubItems(3) = "Andre@White.com"

    .Add , , "2"
    .Item(2).SubItems(1) = "Danny"
    .Item(2).SubItems(2) = "Burnett"
    .Item(2).SubItems(3) = "Danny@Burnett.com"

    .Add , , "3"
    .Item(3).SubItems(1) = "Edward"
    .Item(3).SubItems(2) = "Carter"
    .Item(3).SubItems(3) = "Edward@Carter.com"

    .Add , , "4"
    .Item(4).SubItems(1) = "Anne"
    .Item(4).SubItems(2) = "Witter"
    .Item(4).SubItems(3) = "Anne@Witter.com"

    .Add , , "5"
    .Item(5).SubItems(1) = "Vicky"
    .Item(5).SubItems(2) = "Myron"
    .Item(5).SubItems(3) = "Vicky@Myron.com"
End With
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.