Microsoft Access 2010 tutorial:Master detail report


Master detail report

III. Master detail report

Master detail report is a report that consists of two parts: main report and sub report.  The common use of master detail report is to display category by items. When you want to see the category and its products, the master detail report is the important thing you should use. The way to create master detail report is similar to the way you create master detail form when you Subform/Subreport control. You can create a master detail report in three ways as the following:

IV.1. Create master detail report by using Subform/Subreport control

For example, you have a master detail report as the figure below:

Access master detail report 

To create the master detail report above, firstly, you need to have a main report by constructing it by using Report Design. Then you have to drag Subform/Subreport on the main report as the figure:

Access master detail report design

When you drag and drop the Subform/Subreport control on the main report, the SubReport Wizard dialog box appears. Now, Access starts the subreport wizard and you must follow the following steps:

- Click Next

Access displays the second SubReport Wizard dialog box.

Access subreport wizard 2 

This dialog box allows you to select the fields you want to show on your subreport.

- Click drop-down arrow of combo box

- Click the table's name of the subreport (TblProduct)

- Click Access subreport wizard select field or Access subreport wizard select fields or double-click the fields you to display on the subreport

- Click Next

Access displays the third SubReport Wizard dialog box.

Access subreport wizard 3

This dialog box allows you to define which fields link your main report by choosing from a list or defining your own. If you want to define fields from the list, click Choosing define a list option button. Otherwise, click Define my own option button if you want to define fields by yourself. Suppose, you select Choose from a list.

- Click Next

Access displays the last SubReport Wizard dialog box.

Access last subreport wizard 

This dialog box allows you to set the subreport's title.

- Click Finish

- Click View

You get the master detail report as the figure below:

Access master detail report's result

Your master detail report may look not nice like the master detail report example above, don't wary, open the report in Design View and make the design changes to the report as you like

IV.2. Create master detail report by using table

This is the second way of creating a master detail report. By using this way, you may spend less time than using Subform/Subreport control. We use the master detail report example above to express you. To create the master detail report, do the following:

- Create a main form in Design View

- Drag and drop TblProduct on the main report as the figure below:

Access master detail wizard 1

Access starts the subreport wizard, so you can follow the steps of subreport wizard that already demonstrated in Creating master detail report by using Subfrom/Subreport control section.

Note: By creating master detail by using Subform/Subreport control and by using  table, you also can create the main report by using Report Wizard, but you need to open it in Design View before you place Subform/Subreport on it. When you drag Subform/Subreport control on the main report make sure it is selected with Wizard.

IV.3. Create master detail report by using subreport

It is the last way of creating a master detail report. By using this way, you need to create a main report by using Report Wizard as the figure:

Access master detail report in design view 

Then you need to create a subreport by using Report, Blank Report, Report Wizard or Report Design as the figure:

Access subreport product 

Next, you need to drag and drop the subreport on the main report as the figure:

Access master detail report design 

In this view, you can make advanced design changes to the report such as changing the report's title, font name, color, back ground, resizing text boxes, etc.

Lastly, click View to see the result.

Access master detail report's result 

Note: The main report and subreport must have a linking field. If not, Access cannot create a useful master detail report. See the master detail report example above, the main report have a linked field with the subreport through CategoryID.


Comments




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.