Microsoft Access 2010 tutorial:Controls Part III


Controls Part III

V.9. Subform/Subreport

Sub Form/Sub Report is used to create a form with sub form when you use it on a form. Alternatively, SubForm/SubReport is used to create a report with sub report when you use it on a report. It is used for the tables that have relationship with each other in order to show the relative data. For example, create a form to show the product by category. To do so, you need to create a form by using Form Wizard or Form Design. Suppose you create a form by using Form Wizard. To create a form via this style, do the following:

- Click Create tab

- Click Form Wizard in Forms group

Access displays the Form Wizard dialog box.

- Click drop down arrow of Tables/Queries

- Select TblCategory like the figure:

Access 2010 Form Wizard dialog box

For the final dialog box of Form Wizard, choose Modify the form's design. After you create a form already continue the step:

- Drag and drop a Subform/Subreport control on a form( There are two ways to drag and drop a Subform/Subreport on a form: drag and drop a Subform/Subreport with wizard and without wizard)

V.9.1. Using Subform/Subreport with wizard

- Set your mouse pointer with Control Wizards like the figure:

Access 2010 Control Wizard

- Drag and drop a Subform/Subreport on a form

Access displays SubForm Wizard dialog box.

Access 2010 SubFrom Wiard

- Click Next --> Select TblProduct

Access 2010 SubForm Wizard dialog box

- Click Access 2010 Select All Fields Button --> Next--> Finish

V.9.2. Using Subform/Subreport without wizard

- Unselect mouse pointer with Control Wizard

- Drag and drop a Subform/Subreport on a form

- Click a Subform/Subreport

- Press F4 if the property sheet is not displayed

- Click Data tab

- Click drop down arrow in front of Source Object property

Access 2010 Sub Form With Source Object

- Click View to see the result

Result:

Access 2010 Subform/Subreport

Note: Category table (TblCategory) and Product table (TblProduct) have a relationship with each other through CategoryID. Creating a form and a subform(Child Form) is based on this relationship.

V.10. Tab Control

Tab Control is used to display the data in many tables on a form that each table's data is on different tabs. For example, to use Tab control to display the data of employees and their families,  follow the steps below:

- Drag and drop Tab Control on a form as the shown figure:

Access 2010 Tab Control

- Click Add Existing Fields

Access displays the Field List pane

- Click Show all tables if the name of tables are not displayed

- Drag and drop the fields of TblEmployee that you want to display

+ Employee Infomation tab

Access 2010 Tab Control1

+ Spouse Information tab

Access 2010 Tab Control2

+ Result

Access 2010 Tab Control3

V.11. Image

Image is used to display the picture. For example, uses Image to display the pictures of employees. To do so, follow the steps:

- Drag and drop Image on a form like the figure:

Access 2010 Image Control1

- Set the name of Image as Image0

- Type the VBA Code below:

Access 2010 Image Control2

Result:

Access 2010 Image Control3

V.12. Chart

Chart control is used to summary the data from the table or query or both. You can place it on the form or report. For example, you want to summary the quantity of product by category by retrieving data from TblProduct. The summary data displays on the form. To do so, following steps below:

- Create a form by using Form Design

- Drag and drop a Chart control on a form

Access displays the first Chart Wizard dialog box as the figure below:

Access the first step of chart wizard 

This dialog box allows you choose which data source (table or query or both) you want to display on the chart.

- Click TblProduct

- Click Next

Access displays the second Chart Wizard dialog box as the figure:

Access the second step of chart wizard 

This dialog box allows you to choose fields contain the data you want for the chart.

- Click Access select one field  to select a field for each time or click Access select all fields to select all fields

Access the second step of chart wizard select fields 

- Click Next

Access displays the third Chart Wizard dialog box as the figure:

Access the third step of chart wizard 

This dialog box allows you to choose type of chart that appropriately display for the fields you have selected. For example, you like column chart.

- Click Column Chart

- Click Next

Access displays the fourth Chart Wizard dialog box as the figure:

Access the fourth step of chart wizard 

In this dialog box, you can drag and drop field buttons to the sample chart, changing summarize data or group data of the chart by double-clicking a number or data field in the chart. Moreover, you preview the chart to see its lay out. To see the preview chart, click Preview Chart. For example, you to replace Series in the preview chart by Category. To do so, do the following:

- Drag and drop CategoryID button on the Series button as the figure below:

Access the fifth step of chart wizard 

- Click Next

Access displays the last Chart Wizard dialog box as the figure:

Access the final step of chart wizard 

This dialog box allows you to type the title, to display or don't display a legend. If you want to display a legend, click Yes, display a legend. If you don't want, click No, don't display a legend.

- Click Finish

Access displays a chart in Form Design as the figure:

Access chart in Design Form

- Click View to see the result

Access viewing chart 




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.