Glossary Item Box
ActiveReports allows you to create Master Detail reports by using subreports to retrieve and group data.
This walkthrough illustrates how to create a Master Detail report with subreports.
This walkthrough is split up into the following activities:
To complete the walkthrough, you must have access to the NorthWind database (NWind.mdb).
When you have completed this walkthrough, you will have a report that looks similar to the following.
To add two ActiveReports to your project
To connect the Master report to a data source
To connect the Detail report to a data source
To add controls to the report
Control | DataField | Name | Text/Caption | Misc Details | Location |
---|---|---|---|---|---|
Label | (Empty string) | lblOrderDate | Order Date | (Empty string) | 0.0625, 0.0625 |
Label | (Empty string) | lblShipName | Ship Name | (Empty string) | 1.125, 0.0625 |
Label | (Empty string) | lblShipDate | Shipped Date | (Empty string) | 2.187, 0.0625 |
Label | (Empty string) | lblShipAddress | Ship Address | (Empty string) | 3.25, 0.0625 |
Label | (Empty string) | lblShipCountry | Ship Country | (Empty string) | 4.437, 0.0625 |
Label | (Empty string) | lblFreight | Freight | (Empty string) | 5.687, 0.0625 |
Textbox | OrderDate | txtOrderDate | Order Date | (Empty string) | 0.0625, 0.3125 |
Textbox | ShipName | txtShipName | Ship Name | (Empty string) | 1.125, 0.3125 |
Textbox | ShippedDate | txtShippedDate | Shipped Date | (Empty string) | 2.1875, 0.3125 |
Textbox | ShipAddress | txtShipAddress | Ship Address | (Empty string) | 3.25, 0.3125 |
Textbox | ShipCountry | txtShipCountry | Ship Country | (Empty string) | 4.4375, 0.3125 |
Textbox | Freight | txtFreight | Freight | OutputFormat =
Currency |
5.687, 0.3125 |
Subreport | (Empty string) | ctlSubreport | (Empty string) | (Empty string) | 0, 0.5625 |
Label | (Empty string) | lblWhiteLine | (Empty string) | Background Color = White | 0, 1.75 |
Control | DataField | Name | Text/Caption | Misc Details | Location |
---|---|---|---|---|---|
Textbox | OrderID | txtOrderID | Order ID | (Empty string) | 0.0625, 0.25 |
Textbox | ProductName | txtProductName | Product Name | (Empty string) | 2.3125, 0.25 |
Textbox | products.ProductID | txtProductID | Product ID | (Empty string) | 1.1875, 0.25 |
Textbox | Quantity | txtQuantity | Quantity | (Empty string) | 3.4375, 0.25 |
Textbox | Discount | txtDiscount | Discount | OutputFormat = Currency | 4.5625, 0.25 |
Label | (Empty string) | lblOrderID | Order ID | (Empty string) | 0.0625, 0 |
Label | (Empty string) | lblProductID | Product ID | (Empty string) | 1.1875, 0 |
Label | (Empty string) | lblProductName | Product Name | (Empty string) | 2.3125, 0 |
Label | (Empty string) | lblQuantity | Quantity | (Empty string) | 3.4275, 0 |
Label | (Empty string) | lblDiscount | Discount | (Empty string) | 4.5625, 0 |
To write the code in Visual Basic
- Retrieve subreport data at run time
To write the code in C#
- Retrieve subreport data at run time
The following example shows what the code for the method looks like.
' Visual Basic
Private Sub Detail_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ Detail.Format
Dim rpt As New rptDetail()
Me.ctlSubreport.Report = rpt
End Sub
//C#
private void Detail_Format (object sender, System.EventArgs e)
{
rptDetail rpt = new rptDetail();
this.ctlSubReport.Report = rpt;
}
To view the report
See Also |
Samples | Walkthroughs | OutputFormat Strings
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.