VBGood网站全文搜索 Google

首页 - 经验之谈 - 在VB中建立和实用数据报告
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:11264, 日期:2000-11-12
Creating Reports in VB 6.0 Using the Data Report Designer

In last month抯 article, I explained how to use the Data Environment Designer to quickly and easily create data connection and command objects to handle access to a database from a VB project . In this article, I explain how to use the Data Report Designer to create simple and elegant reports based on existing data environment objects.

The Data Report Designer

Like the Data Environment Designer, the Data Report Designer is a very practical feature that has been added to VB 6.0. Although third-party reporting products are still supported in VB 6.0, it is advised that new reports are created using the Data Report Designer. The Data Report Designer is basically a report generator that simplifies the creation of simple and hierarchical reports. These reports can be formatted and sent to a printer or exported to external HTML or text files.

Features of the Data Report Designer

The Data Report Designer has many features. The most important ones include:

  1. Drag-and-Drop capability. Fields to appear on the report can be dragged from a command object in the data environment window and dropped on the report in the Data Report Window. The DataSource property is automatically set to the data environment object from which it was dragged. The DataMember property is set to the corresponding command object. And the DataField property is set to the field that was dragged.
  2. Report Tool Box and Controls. The Data Report Designer has its own Tool Box which contains controls designed specifically to be used on reports such as labels, text boxes, images, lines, shapes, and functions.
  3. Predefined fields to display date, page number, and number of pages among other things. Each of these predefined fields uses a code to display the required information. The following table summarizes these codes.




Current page number


Total number of pages in the report


Current date in short format


Current date in long format


Current time in short format


Current time in long format


Report title as specified in the Title property