Library code snippets
Create flexible reports with Data Report utility
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 the 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 whats happening. On the main form, you will see the following four buttons:
- Show Report: This will display the report on the screen.
- 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
- Export to HTML: This will export your report to the html format, you can
select the number of pages you want to be exported to the html.
- 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!!!!
Here are the steps needed to create the project:
- Start a new VB project (EXE)
- Insert dataenvironment and change its connection property to point towards
the biblio database that comes with the VB
- Insert a command and point it towards the publishers table
- Insert a child command and point it towards a title table
- Add a data report utility from the project menu.
- Open the data environment and data report windows and place them side by
side.
- To change the data report utility to better suit the data environment that
was previously defined, first change the data report's data source 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.
- Change the format of the report according to your own needs.
- See the form's code to understand the functions that are needed to display, print and export the report to the html format.
Happy programming!!!!!
Related articles
Related discussion
-
VB6, SQL 2005 & DMO
by elajaunie3 (1 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
Automating Excel from VB6.0
by epurdy (0 replies)
-
VB6 system conversion using VBA to Word 2007
by b.macgregor@vodamail.co.za (0 replies)
-
video not working with visual basic
by Jupiter 2 (9 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
I'm working with VB6 and SQL2000. I design a report using data report. I set the datasource to recordset (assign recordset dynamically) but notice that the records displayed is always less by one. That the report will not display the last record in the recordset. If the SQL statement retrieve only one reord the report is blank, though it show blank report.
Didn't work--Form will come up but not the dataenvironment or datareport.
This thread is for discussions of Create flexible reports with Data Report utility.