Ms Access 2010 tutorial: create form


Create form

II. How to create form

Form is an object in Access database that helps user in entering, editing, finding and deleting data easily. In Access 2010, you have a number of ways to create a form as the following:

II.1. Create a form by using Form tool

If you want to see your form displaying all fields in the underlying table or query, if you want to create a form quickly, less than one minute, use Form tool. To create a form, follow the steps below:

- Open your database

- In the Navigation Pane, click the table or query you want to show its data on the form

- Click Create tab

- Click Form in the Forms group

Access creates and opens the from in Layout view. In Layout view, the form displays the data and you can make design change to the form such as resizing the text boxes, adding controls and changing its shape and color, setting background, changing size and color of the data, and so on.

If the table you used to create the form has one-to-many relationship with other single table, Access will add a datasheet to the form that relies on the related fields of the two tables. For instance, TblCategory has one-to-many relationship with TblProduct through CategoryID. When you use TblCategory to create a form, Access provides you the form with the datasheet as the figure below:

Access relationship form 

The datasheet shows all records in the table base on category id. If you move record to Cate002 , the datasheet displays all product records that are in Cate002 category. If you move record to Cate003, the datasheet displays product records in Cate003 and so on. If you don't need the datasheet, delete it. To delete the datasheet, you must open the form in Layout view or Design view and then do the following:

- Click the datasheet

- and then click delete key.

II.2. Create a form by using Form Design

If you want to customize the form  by dragging the fields from the table, adding controls, setting properties to the controls by using property sheet, adding VBA code to the controls and so forth, use Form Design. By using Form Design, you can create two types of form: Bound Form and Unbound Form.

II.2.1. Create an unbound form

An unbound form is a form that cannot display data form a data source (a table or query) directly; it need the VBA code to do this task. To create the unbound form do the following:

- Open your database

- Click Create tab

- Click Design Form in Forms group

Access creates a blank form and opens it in Design view as the figure below:

Access form design 

You can add the controls as you want. For example, you want to add two text boxes and one button on the form. To do so, drag and drop the controls on the form as the shown figure below:

Access add control on form 

The unbound form above cannot perform action unless you add the VBA code to its controls. To learn the VBA code, visit Access 2010 VBA tutorial.

II.2.2. Create a bound form

A bound form can display all data form a data source( a table or query) without apply the VBA code. To create a bound form, follow the steps below:

- Open your database

- Click Create tab

- Click Form Design in the Forms group

Access creates and displays a blank form in Design view.

- Click Add Existing Fields next to Property Sheet in Tools group of Design tab

Access displays the Field List pane as the figure below:

Access field list pane 

- Click Show all tables

The Field List pane shows all tables in the current database as the figure:

Access field list pane show tables 

- Click Plus sign (+) in front the table's name you want to display its data on the form

The table displays all its fields.

- Double click or drag and drop one field, two fields or all fields of the table or tables on the form as you want

- Click View under the File tab to see the result

Note: After you drag a field on form, you can drag many fields on the form by holding down the Ctrl, and then select the fields that you want to drag.

II.3. Create a form by using Blank Form tool

When you want to create a form with no control or format, use Blank Form tool. It helps you to build the form quickly. Once you click Bank Form tool, access create a bank form and open it in Layout view with Field List pane. Then you can start to build the form by do the following:

- Click Plus sign(+) in front of the table's name that you want to show its data on the form

- Double click or drag and drop the fields of the table or tables

- Click View under the File tab to see the result

II.4. Create a form by using Form Wizard

If a few ways of creating form above do not meet your need,  use Form Wizard. Form Wizard helps you to build a form step by step by answering a few questions. To create the form via Form Wizard do the following:

- Open your database

- Click Create tab

- Click Form Wizard in Forms group

Access displays Form Wizard dialog box as the figure:

Access form wizard 1

- Click drop down arrow of combo box to choose the table or query you want to show its data on the form.

- Click Access select one field  or Access select all fields to select field or fields from Available Fields list box to Selected Fields list box.

- Click Next button

Access displays the second Form Wizard dialog box. This dialog box allows you to choose layout of your form.

Access Form Wizard 2

Access provides you four types of layouts such as columnar, tabular, datasheet, and justified  to apply your form. You can select one among four types of these layout. To see each layout, click the each layout and look the preview box. Suppose you like columnar layout.

- Click Columnar

- Click Next button

Access displays the last Form Wizard dialog box.

Access Form Wizard 2 

This dialog allows you to type the title of the form and select the two views of the form. You can view the form in Form view if click Open the form to view or enter information. If you want your form to open in Design view, click Modify the form's design.

- Click Finish button

II.5. Create a form by using More Forms tool

By using More Forms tool, you can create a variety of form types such as Multiple Items, Datasheet, Split Form, Modal Dialog, PivotTable, and PivotChart. But in this tutorial, we show you only two types of form that are frequently used. Those two types are Multiple Items and Split Form.

II.5.1. Create a form to display multiple records by using Multiple Items tool

By using Multiple Items tool, you can show multiple records form the table or query. You can add more controls to the form and apply the VBA code to the form its controls. To create the form follow the steps below:

- Open your database

- Click name of table or query that you want to display its data on the form( e.g. TblBook) in the Navigation Pane.

- Click Create tab

- Click More Forms in the Forms group

- Click Multiple Items

Access creates the form showing multiple records and opens it in Layout view. See the figure below:

Access multiple records form 

In Layout view, the form can display data but you cannot make change to the data. However, you can make design change to the form such as changing logo, title, adding date and time, changing font, color, size of the displaying data, resizing the width and height of the controls on the form, and so on.

+ If you want to resize the text boxes on the form, click the text box and then do the following:

    - Move cursor as the Acc01figure if you want to resize the height of text boxes.

      Access resize height of text boxes 

    - Move cursor as the Acc02 figure if you want to resize the width of the text boxes.

      Access resize width of text boxes 

To add more records, you need to view the form. To view the form, click View under File tab.

II.5.2. Create a split form by using Split Form tool
If you want your form to show a form in the upper section with a datasheet in the lower section , use Split Form tool. On Split Form you can add new record in two way: entering record in the form or datasheet. Moreover, you can edit or delete the record in either part of the form. To create the split form follow the steps below:

- Follow step 1 till step 4 of creating form by using Multiple Items tool above.

- Click Split Form

Access creates the split form and opens it in Layout view as the figure:

Access split form

In the Layout view, the form can display data but you cannot change the data. However, you can make design change to the form such changing logo, title, adding date and time, changing font, size, color of the data, resize the width and height of the controls on the form and so on.


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.