Click here to Skip to main content
6,596,602 members and growing! (20,370 online)
Email Password   helpLost your password?
Languages » VBScript » Visual Basic     Intermediate

Create flexible and robust reports using VB's datareport utility

By S.S. Ahmed

This application shows how to create flexible and robust reports using VB's data report utility.
VBScript, VB 6Win2K, Dev
Posted:4 Nov 2001
Views:389,477
Bookmarked:39 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
48 votes for this article.
Popularity: 5.52 Rating: 3.28 out of 5
11 votes, 29.7%
1
1 vote, 2.7%
2
6 votes, 16.2%
3
6 votes, 16.2%
4
13 votes, 35.1%
5

Sample Image - datarep.jpg

Introduction

This project will show you how to create reports in VB using the data report utility. This utility is very easy to use and it only takes minutes to create flexible reports using this utility. For this project, I have used the biblio database that comes with VB6, so make sure that the biblio database is available on your machine in the directory where VB is installed. I have used data environment to connect to the database and the report fetches the records directly from the database (via data environment). I wanted to write a complete article about the usage of this utility but alas! the time is short. So, you will have to delve into the code yourself to see what's happening. On the main form, you will see the following four buttons:

  1. Show Report: This will display the report on the screen.
  2. Print Report: This will send the report to the printer, printer should be installed or you will get an error message saying that no printer was found.
  3. Export to HTML: This will export your report to HTML format, you can select the number of pages you want to be exported to HTML.
  4. Exit: You can exit the application by clicking this button.

You can drag the fields directly from the data environment on to your report. That's it!!!!

Creating the application

Here are the steps needed to create the project:

  1. Start a new VB project (EXE).
  2. Insert data environment and change its connection property to point towards the biblio database that comes with VB.
  3. Insert a command and point it towards the publishers table.
  4. Insert a child command and point it towards a title table.
  5. Add a data report utility from the project menu.
  6. Open the data environment and data report windows and place them side by side.
  7. To change the data report utility to better suit the data environment that was previously defined, first change the data report's datasource property to dataenvironment1 (you can change the name of the data environment) and its datamember property to publishers. Next, right click anywhere within the data report window and choose the retrieve structure option. Click yes.
  8. Change the format of the report according to your own needs.
  9. See the form's code to understand the functions that are needed to display, print and export the report to HTML format.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

S.S. Ahmed


Member
S.S. Ahmed is a senior software engineer and works for a web and software development firm. Ahmed is a Microsoft Office SharePoint Server MVP. Ahmed specializes in creating database driven dynamic web sites. He has been creating customized SharePoint solutions for the last five years. Ahmed has worked in Visual Basic, Visual C, Java, ASP, .NET, SharePoint, InfoPath, BizTalk, etc. Ahmed enjoys travelling and has been to many parts of the world. Ahmed distributes most of his work freely to many internet sites. Ahmed also participates in different newsgroups and tries to help people out with their problems. Ahmed can be reached at share.point@yahoo.com

PEACE

S.S. Ahmed
Web: www.walisystems.com
Blog:www.sharepointblogs.com/ssa
Occupation: Web Developer
Location: Pakistan Pakistan

Other popular VBScript articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 143 (Total in Forum: 143) (Refresh)FirstPrevNext
GeneralMy vote of 2 Pinmembersubdeery7:17 3 Jul '09  
Generalhow to find data from report using VB6.0 Pinmemberlinda_azrul15:44 18 Mar '09  
NewsRe: how to find data from report using VB6.0 Pinmembersowsri2:14 15 Aug '09  
QuestionExporting in HTML from MSHFLEXIGRID ON FORM PinmemberParag Raibagkar20:36 29 Dec '08  
Generalhelp!!!! PinmemberXhanty7:26 8 Oct '08  
GeneralData report PinmemberPayal Tewari21:59 22 Jun '08  
Questiondata report user selection Pinmembershaktipunjabi20086:25 20 May '08  
Answerhow to generate report on user's selection or conditions Pinmemberkiarm2:30 24 Apr '08  
GeneralThe most challenging report i have ever come across Pinmembernareshagarwal0:46 19 Dec '07  
QuestionPrint forms, receipts and others reports Pinmembernareshagarwal0:27 19 Dec '07  
GeneralGenerating data report from two different database PinmembervickyVB23:50 15 Sep '07  
GeneralHow to create data report base on user define entery PinmemberEnyim2:02 7 Sep '07  
GeneralRe: How to create data report base on user define entery Pinmemberspidy220518:38 7 Jul '09  
Questionhow to create a report using vb as front end and access as backend? Pinmemberpreci1:58 9 May '07  
Questionis this a joke? Pinmemberisyan15:49 1 May '07  
AnswerRe: is this a joke? PinmemberPIEBALDconsult16:12 1 May '07  
GeneralData Environment !!! PinmemberDawyne3:33 7 Apr '07  
Questionhow to bold and hight use in run time line on datareport Pinmembertrimurarisingh4:06 5 Mar '07  
AnswerRe: how to bold and hight use in run time line on datareport Pinmembertusprogramas716:59 16 Mar '07  
GeneralRe: how to bold and hight use in run time line on datareport Pinmemberhelitb19:11 5 Jun '07  
Generaldata report connection through coding Pinmembervhinzhientt4:50 3 Jan '07  
GeneralRe: data report connection through coding Pinmemberoxela22:01 14 Jun '09  
QuestionCoulmnwise total in VB6 data report utility Pinmemberarun a3:23 27 Oct '06  
QuestionNumber of Records per page PinmemberAndre Falci4:48 10 Oct '06  
QuestionRe: Number of Records per page Pinmemberlalit agrawal8:25 3 Nov '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 4 Nov 2001
Editor: Smitha Vijayan
Copyright 2001 by S.S. Ahmed
Everything else Copyright © CodeProject, 1999-2009
Web15 | Advertise on the Code Project