One of the reasons that Visual Basic 6 is
such a popular programming tool is because of its sophisticated
support for database programming. Tools such as the Visual Data
Manager and the User Connection component greatly simplify tasks
that were very time consuming. Another powerful database tool that
VB programmers have at their disposal is the Data Report Designer,
which lets you create complex reports from almost any data
source.

The Data Report Designer creates banded
hierarchical reports. These are the most common type of database
report; you’ve probably seen many of them, with headings,
subheadings, details, and summaries organized in a hierarchical
manner.

A Data Report is similar to a VB form in that
it has a visual designer and a code module. Using the visual
designer, you can divide the report into two or more sections, each
with its own headings. Each section can contain controls to display
the report details. The design of the details sections is
simplified by drag-and-drop functionality. The available controls
are distinct from VB controls but have similar functionality. In
particular, the Function control lets you easily perform
calculations on field data (sum, average, minimum, and maximum) and
display the results as the report is generated. Headers and footers
can be defined for the report as a whole and for each page of the
report.

At run-time, output options are quite
impressive. For instance, the Print Preview mode shows what the
printout of the report will look like. Printing is a simple matter
of calling the PrintReport method. Export to a file is supported in
both HTML and text formats.

The Data Report Designer is a very impressive
tool. It’s not suitable for every type of report, but when it fits
your needs, it can save you a tremendous amount of time.

Advance your scripting skills to the next level with TechRepublic’s free Visual Basic newsletter, delivered each Friday. Automatically sign up today!