Data Report and Data Environment

Submitted by: 
Visitors have accessed this post 41545 times.

In this tutorial I will teach you on how to create report using Data Report in Visual Basic 6.0. The source code contain here is based on my previous submission called Simple Example of Connecting Database Using Data Environment except that I added a Data Report in this tutorial.

After you read this tutorial you will find how easy is it to create a data report in your VB 6.0 application. Although I don’t recommend using data report as it is lacking so many features that can be found in crystal reports, but in an application that don’t need a complicated report, data report can be the best alternative.

Steps to add data report and how to setup its DataSource, DataMember and DataField to display the record that you like.

1. Add Data Report to your project

Add Data Report

2. Set DataSource and DataMember to your Data Report

DataSource and DataMember

3. Add a TextBox to the detail section of your Data Report

Add TextBox

4. Set the DataMember and DataField to the TextBox

DataMember and DataField

5. Repeat these steps to add more TextBox and bound it to the DataMember and DataField based on the field you select.

Additionally I created a button called CmdPrint to open our newly created Data Report. Within the click event of this button put the code below:

  1. Private Sub CmdPrint_Click()
  2. drCustomers.Show
  3. End Sub

I hope this helps



How to report in Landscape paper in Data Report?


it help my vb class.. thank you!

What about Cristal Report in

Its very nice
Thank you

i used a DataEnvironment.... a code in search

im using Visual Basic 6.0, my database is MSAccess 2000 format, then i have a problem in my DataReport because i dont know how to show pictures from my application going to data report....sample: members info and picture...i want it to show in my data report and the only parameter i used is the path of that picture...can u help me? my email is [email protected] Thanks!

how to connect to oracle using dataenvironement
pl help

how to add picture using dataenvironment in vb 6.0?

im using data report...i don know how to show data from my listview after searching and print it.can u help email [email protected]

can anyone help me, if i open my report at once i shoq butm8 in 2nd time, debug.. it says operation is not allowed if the object is open.. how can i solve this?? please help me..

Good Job

AS i know in data report when i click on print report command that time in database image is loaded in i can do that

how can i select aa particular row from the data base and display in the data report
like my table contains fields like id,code,location,donar as fields
if i had to select the in formation related to a particular code and display the information relatioed to it that is only that one row
how can i do it
plz help me
[email protected]

hi,sir i create data report that print ricipt.but sir detail section data is repeated three time. my code isPrivate Sub Command1_Click()
Set rsh1 = New ADODB.Recordset
rsh1.Open "ricipt", con, adOpenKeyset, adLockOptimistic
With DataEnvironment1
.rsCommand4.Open "Select ReceivedWith,Receiptno,place,addr,vehi_type,vehi_value,By,drawee,Number,dated,SrNo,contract,description,amount from ricipt,debtor where ReceivedWith = '" & Combo1.Text & "'"
s1.Sections(2).Controls("Label8").Caption = .rsCommand4.Fields("ReceivedWith").Value
s1.Sections(2).Controls("rn").Caption = .rsCommand4.Fields("Receiptno").Value
s1.Sections(2).Controls("lblplace").Caption = .rsCommand4.Fields("place").Value
s1.Sections(2).Controls("lbladd").Caption = .rsCommand4.Fields("addr").Value
s1.Sections(2).Controls("lblvehi").Caption = .rsCommand4.Fields("vehi_type").Value
s1.Sections(2).Controls("lblvev").Caption = .rsCommand4.Fields("vehi_value").Value
s1.Sections(2).Controls("lblby").Caption = .rsCommand4.Fields("By").Value
s1.Sections(2).Controls("lbldrw").Caption = .rsCommand4.Fields("drawee").Value
s1.Sections(2).Controls("lblno").Caption = .rsCommand4.Fields("Number").Value
s1.Sections(2).Controls("lbldate").Caption = .rsCommand4.Fields("dated").Value
End With
End Sub
plz sir help me

That was really helpfull, Thank you very much...

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe>
  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.