Add a total field to the data report _vba

Source: Internet
Author: User

Therefore, a total field is similar to a Function control because both are evaluated when the report is generated. But there are some differences: a Function control can only be placed in a group footer, and a total field can be placed in any part of the data Report Designer, excluding the report Header/footer and the page header section.

Another difference is in how two fields are created: Although a Function control is a feature of the Data Report Designer, the aggregate field is a feature of the Data Environment designer. To add a total field to a report, the steps are:

    1. Create a total field in the Data Environment designer.

    2. From the Data Environment Designer, drag the Totals field onto the Data Report Designer.

As an example, the following illustration shows a total field showing the number of ordered products.

Data report with an aggregate field

Using a Function control can be more efficient than using a total field. When a data report evaluates a value for a Function control, it takes a certain amount of processing to create each value. When the data environment creates an aggregate field, it spends a similar amount of processing. However, you can save processing time by using a Function control, because the Data Report Designer must create the entire report in its own processing.

Note This topic is part of a series of steps that help you create a sample data report. Creating a simple Data report is the first topic in this series.

to create a total field in the data environment, follow these steps:

    1. On the Data Environment designer, open the Detail Fields in Customers folder, right-clickOrders, and then click Properties.

    2. In theOrders Propertiesdialog box, click the Totals tab.

    3. Click the Add button.

    4. Click the Name box and type "productcount".

    5. In the Functions combo box, selectCNT.

    6. In the Totals combo box, selectOrderDetails(the default should be checked).

    7. In the field combo box, selectProductID.

    8. Click OK to close the dialog box.

Now that you have created the total field, you can put it in the Data Report Designer.

to add a total field to a data report, follow these steps:

    1. From the Data Environment Designer, drag theproductcounttotal field to the group named "Orders_header."

    2. Change the Label control's Caption to "Product (s) Ordered."

    3. Reposition and resize the TextBox and Label controls so that they resemble the following illustration:

    4. Save and run the project.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.