Data Report and Data Environment

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:

Private Sub CmdPrint_Click() drCustomers.Show End Sub

I hope this helps

Comments

Submitted byAnonymous (not verified)on Thu, 12/10/2009 - 18:53

thanks
Submitted byAnonymous (not verified)on Wed, 02/10/2010 - 21:19

In reply to by Anonymous (not verified)

How to report in Landscape paper in Data Report?
Submitted byAnonymous (not verified)on Tue, 01/12/2010 - 13:29

IT IS NICE..... tHANKU.....
Submitted byAnonymous (not verified)on Mon, 01/25/2010 - 10:53

it help my vb class.. thank you!
Submitted byAnonymous (not verified)on Wed, 01/27/2010 - 22:48

What about Cristal Report in VB.net
Submitted byAnonymous (not verified)on Wed, 02/17/2010 - 13:11

Its very nice Thank you
Submitted byAnonymous (not verified)on Fri, 08/20/2010 - 16:03

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!
Submitted byAnonymous (not verified)on Thu, 10/07/2010 - 19:57

how to connect to oracle using dataenvironement pl help
Submitted byAnonymous (not verified)on Fri, 10/15/2010 - 12:24

how to add picture using dataenvironment in vb 6.0?
Submitted byAnonymous (not verified)on Tue, 11/09/2010 - 11:03

im using data report...i don know how to show data from my listview after searching and print it.can u help me...plez..my email [email protected]
Submitted byAnonymous (not verified)on Wed, 01/12/2011 - 10:08

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..
Submitted byAnonymous (not verified)on Tue, 03/01/2011 - 16:50

Good Job
Submitted byAnonymous (not verified)on Sun, 05/15/2011 - 23:51

AS i know in data report when i click on print report command that time in database image is loaded in datareport.how i can do that
Submitted byAnonymous (not verified)on Wed, 05/18/2011 - 12:19

hello 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] thanks
Submitted byAnonymous (not verified)on Fri, 06/10/2011 - 13:40

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 s1.Refresh s1.Show End With rsh1.Close End Sub plz sir help me

Add new comment