Access labs 2017
Design Customization
Lesson 5 – creating forms
Lesson 5 – creating forms
Lesson
5
Lesson 5 - Creating Forms
Lesson Topics:
5.1 Using the Form Wizard
5.2 Entering Data into a Form
5.3 A Look at Design View
5.4 Adding a Field to a Form
5.5 Changing Control Properties
5.6 Using Layout View
5.7 Finding Records in a Form
5.1 Using the Form Wizard
This lesson will guide you through the process of creating a form with the Form Wizard.
A
form is an interface between the user and the data, utilized primarily to enter, edit or display data in a database. The form window contains labels (descriptive text), text boxes, combo boxes, radio buttons etc. that are bound to the data in your table and can help make your database more user-friendly. Entering or changing data in a form automatically enters or changes it in the underlying table. XE "Wizards:forms" XE "Forms:creating with form wizard"
Using the Form Wizard is the easiest way to create a form. The Form Wizard is similar to the Query Wizard that we worked with in the last chapter – it will step you through the process of creating a form. While you can create a form from scratch, using the Form Wizard is much easier and much quicker.
You may want to consider creating a query upon which to base your form, rather than using a table as the form’s data source. Using a query allows you to filter the data that is displayed in the form and provides more flexibility in sorting your data.
To Create a Form using the Form Wizard
1. Click the Create tab on the Ribbon.
2. Click the Form Wizard button
3. From the Tables/Queries drop-down list, choose the table or query upon which to base your new form.
4. Choose fields to add to the form by clicking the > button to add the selected field. Repeat for all desired fields.
5. To add all fields to the form, click the >> button.
6. Click Next.
7. Choose the desired layout for your form.
8. Click Next.
9. Enter a name for your form.
10. Choose whether to view the form’s design (Design View) or whether to open the form to view or enter information (Form view).
11. Click Finish.
Let’s Try It!
|
What |
Why |
|
1. From the Microsoft Access Welcome Screen, click Open Other Files in the left pane. |
Displays the Open Pane. |
|
2. Click the Browse button in the center pane. |
Displays the Open dialog box. |
|
3. Click Desktop on the left side of your screen. |
Opens the Desktop folder. |
|
4. Double-click the Lesson Files folder. |
Opens the Lesson Files folder and displays the files in that folder. |
|
5. Select the Video Sales 5 file and then click Open. |
Opens the Video Sales 5 database. |
|
6. Click the Navigation Pane drop-down menu and select Forms from the list. |
Displays form objects. Currently, there are no forms created. |
|
7. Click the Create tab on the Ribbon. |
Displays commands for creating Access objects. |
|
8. Under the Forms command set, click the Form Wizard button as shown below. |
Launches the Form Wizard. |
|
|
|
|
9. Click the arrow on the right of the Tables/Queries combo box and then select qryProducts from the drop-down list as shown below. |
Selects the query upon which we want to base our new form. |
|
|
|
|
10. Select the Title field in the Available Fields window and then click the > button. |
Selects the Title field to be added to our form. |
|
11. Repeat Step 11 for the following fields: Category Price Acquired |
Adds the Category, Price and Acquired fields to our form. |
|
12. Click Next. |
Moves to the next step of the Wizard. |
|
13. Ensure that Columnar is selected as shown and then click Next. |
Selects Columnar for our form layout and then moves to the next step of the Wizard.
|
|
14. Type: frmProducts in the form title box as shown. |
Enters the name for the form.
|
|
15. Ensure that Open form to view or enter information is selected, and then click Finish. |
Opens the form in Form View. |
|
The Completed Form |
5.2 Entering Data into a Form
In this lesson, you will learn how to enter new data into a form.
S
imilar to tables, the navigation bar on the bottom of the form window allows you to move from one record to another. Clicking the New Record button creates a new blank record.
To enter data into a form, click in the first blank text box and begin typing. Pressing the Tab key moves you from one field on your form to another. When the cursor is in the last text box of the form, press the Tab key to insert a new blank record. XE "Data:entering into forms" XE "Forms:entering data into"
To Enter New Data into a Form
1. In Form View, click the New Record button.
2. Click in the first text box where you wish to begin entering data.
3. Click Tab to move to the next field.
4. To add another new record, click the New Record button.
Or
Press the Tab key when the cursor is in the last field of the form.
Let’s Try It!
|
What |
Why |
|
1. Click the New Record navigation button on the bottom of the screen. |
Inserts a new blank record. |
|
2. Click in the Title text box and then type: Shallow Hal as shown below. |
Enters data for the Title field. |
|
|
|
|
3. Press the Tab key. |
Moves to the Category field. |
|
4. Type: Comedy and then press the Tab key. |
Enters data for the Category field and then moves to the Price field. |
|
5. Type: 39.99 and then press the Tab key. |
Enters data for the Price field and then moves to the Acquired field. |
|
6. Type: 2/15/2013 |
Enters the data for the Acquired field. |
|
7. Press Tab. |
Inserts a new blank record. |
5.3 A Look at Design View
In this lesson, we will look at our form in Design view.
D
esign View is where you make changes to your form. For example, you can add additional descriptive text to your form, add or delete fields from your form, and move and/or resize form objects. XE "Design View:forms" XE "Forms:design view" XE "Forms:parts of"
Design View consists of the following sections:
· Detail – where most of the form’s data entry controls appear. This is where data is entered.
· Form Header- information in this section appears on the first page of the form.
· Form Footer – information in this section appears on the last page of the form.
Form Design View
The Form Headers and Form Footers allow you to add descriptive text, such as the purpose of the form, the company name, the date or time the form was created or even a company logo.
The objects on a form are called Controls. These include text boxes, labels, graphics, lines, radio buttons, combo or list boxes, just to name a few. You can add a control to a form by clicking the control you wish to use from the Controls command set under the Design tab and then dragging it onto the form. Positioning your mouse pointer over any tool on the Control command set will display an informational box informing you what that particular control is. XE "Controls:defined" XE "Forms:controls"
Form Controls
Once a control is placed on your form, it can easily be moved to a different location on your form or resized.
To View a Form in Design View
1. Under the Home tab in the Navigation Pane, select Forms from the drop-down list.
2. Right-click the form you want to view and select Design View from the contextual menu
Or
Double-click the form to open it in form view, click the View button arrow and choose Design View.
Or
Click the Design View button on the lower-right corner of the Access window.
View buttons on lower-right corner of the Access Window
Let’s Try It!
|
What |
Why |
|
1. Click the Home tab on the Ribbon. |
Ensures that we are in the Home tab area. |
|
2. Click the arrow under the View button and then select Design View from the menu as shown below. |
Switches to Design View. |
|
|
|
|
3. Move your mouse pointer over the right bottom edge of the form until the cursor transforms into a double arrow. |
Enters resizing mode. We are going to increase the width and the height of our form in order to add additional fields. |
|
4. Click on the edge of the form and then drag outwards and downwards as shown below, until all of the form fields are visible. |
Resizes the form so that all of the form objects are visible. |
|
|
|
|
5. Click the contextual Design tab on the Ribbon. |
Allows us access to our Control commands. |
|
6. Position your mouse pointer over any of the control icons in the Controls command set. |
Displays an informational tag that displays the control name. |
5.4 Adding a Field to a Form
In this lesson, you will learn how to add additional fields to your form.
A
fter creating your form, you may decide that you want to add additional fields from your table or query to your form. To add additional fields to your form, click the Add Existing Fields button in the Tools command set on the Ribbon to display the Field List pane. From the Field List pane, you can either double-click the field name to automatically add it to the form or drag it to the desired location in your form.
To add multiple fields to your form at once, hold down the Ctrl key as you select and then drag the selected fields to your form. XE "Fields:adding to forms" XE "Forms:adding fields to"
To Add Additional Fields to a Form
1. In Form Design View, click the Add Existing Fields button on the Ribbon if the field list is not visible.
2. Click the field in the field list window that you wish to add to the form and hold down the left mouse button.
3. Drag the field to the location of the form where you wish to insert the new field.
4. Release the mouse button.
Let’s Try It!
|
What |
Why |
|
1. Move your mouse pointer over the top of the Form Footer bar until the pointer transforms into a black cross with a vertical arrow as shown below.
|
Before we can add our new field, we need to increase the space of the Detail area to make room for the field. To do this, click on the top of the Form Footer bar and drag downwards. |
|
2. Click and draw downwards about ½ inch as shown below. |
Increases the height of the Detail area by ½ inch. |
|
|
|
|
3. If the field list is not visible, click the Add Existing Fields button on the Tools group on the Ribbon. |
Displays the Field List. |
|
4. Click the Rating field in the Field List Box and then drag to about the 1 ¾ inch mark on the ruler underneath the acquired field as shown below. Release the mouse button. |
Adds the Rating field to the form. |
|
|
|
|
5. Click the Close button on the Field List pane as shown below. |
Closes the Field List pane. |
|
|
5.5 Changing Control Properties
In this lesson, you will learn how to modify the properties of a control.
T
he properties of a control allow you to change the look of that control. Some common properties that you can change are the font size, font style, font color, number of decimal places, caption, and alignment of data within text boxes or labels. Each type of control has many such properties or attributes that you can set. XE "Controls:properties of" XE "Properties Button"
You change control properies via the Property Sheet dialog box, which displays on the right side of your screen. To display the Property Sheet box, select the object and then click the Property Sheet button under the Tools command set on the Ribbon. You can also right-click and then choose Properties from the pop-up menu. Double-clicking an object will also display the properties for that object.
Property Sheet Box for the Text Box Control
To Change the Properties of a Control
1. Select the control whose properties you wish to change.
2. Click the Property Sheet button on the Ribbon.
Properties Button
Or
Right-click and then choose Properties from the pop-up menu.
3. Enter the desired changes in the Properties box.
4. To increase the width of the property sheet pane, move your mouse pointer over the left edge of the Property Sheet pane until your cursor transforms into a double arrow and then drag to the left until the pane is the desired size.
Let’s Try It!
|
What |
Why |
|
1. Select the text box for the Rating field as shown below. |
Selects the object whose properties we wish to change. |
|
|
|
|
2. Click the Property Sheet button on the Tools command set on the Ribbon. |
Displays the Property Sheet box for the Rating field. |
|
3. Scroll down until Font Weight is visible in the Properties box. |
Scrolls down until the property we wish to change is visible. |
|
4. Click in the Font Weight box, click the arrow and then select Bold from the drop-down list, as shown below. |
Sets the font weight of the Rating text box to bold. |
|
|
|
|
5. Click the Close button on the Property Sheet Box. |
Closes the Properties Box. |
|
6. Click the View button on the Ribbon and then observe the Rating field. |
Switches to Form View. Notice that the text in the Rating field is bolded. |
|
7. Click the Save button. |
Saves the design changes. |
5.6 Using Layout View
In this lesson, you will learn how to modify a form in Layout View.
L
ayout View allows you to modify your form and immediately see how your data will appear. When working in Layout View, you can change the design of the form while viewing your actual data, which makes this view extremely useful for changing the size and layout of controls. All of the form objects are selectable – you can change the location and size of objects, add and remove fields, change field names, modify font settings and more. While some tasks can only be completed in Design view, you can accomplish much of your form design in Layout view. XE "Forms:layout view" XE "Layout View in Forms"
SHAPE \* MERGEFORMAT
To display a form in Layout view, click the arrow on the View button in the Home tab and choose Layout View or right-click the desired form and choose Layout View from the contextual menu. You can also click the Layout view icon on the lower-right hand corner of the Access window.
To Display a Form in Layout View
1. Under the Home tab on the Navigation Pane, select Forms from the drop-down list.
2. Right-click the form you want to view and select Layout View from the contextual menu
Or
Double-click the form to open it in form view, click the View button arrow and choose Layout View.
Or
Click the Layout View button on the lower-right corner of the Access window.
Let’s Try It!
|
What |
Why |
|
1. Click the View button arrow on the Ribbon under the Home tab and choose Layout View from the list. |
Displays the form in Layout view. |
|
2. Click on the Rating text box. |
Selects the Rating text box and label. |
|
3. Press the Delete key. |
Deletes the Rating text box and label from the form. |
|
4. Click the Title text box. |
Selects the Title field on our form. |
|
5. Click the contextual Format tab (under Form Layout Tools) on the Ribbon as shown below. |
Displays form formatting tools. |
|
|
|
|
6. Click the Bold button and the Italic button on the Font command set as shown below. |
Applies bold and italics formatting to the selected field. |
|
|
|
|
7. Click the Save button. |
Saves the design changes. |
|
8. Click the Design tab on the Ribbon. |
Switches to Design commands and tools. |
|
9. Click the View button on the Ribbon. |
Displays the form in Form view. |
5.7 Finding Records in a Form
In this lesson, you will learn how to search for records in a form.
T
here will be times when you need to find a particular record in your form. The Find feature allows you to quickly search for information. To launch the Find and Replace dialog box, click the Find button on the Ribbon or press the Ctrl + F keystroke combination. XE "Find and Replace:records in forms"
If you know in which field the information resides, click in that field. This will speed up your search. When searching, you can match either Whole Field (find data that is exactly the same as what you entered in the Find What box), Any Part of Field (find records that contain the data in the Find What box at any position in the field), or Start of Field (locate records that contain the data in the Find What box at the beginning of the field). XE "Forms:finding records in"
To Find Data in a Form
1. Open the form in Form View.
2. Click in the text box of the field in which you wish to search for data.
3. Click the Find button
Or
Press the Ctrl + F keystroke combination.
4. Type the data you wish to find in the Find what box.
5. Select Whole Field, Any Part of Field or Start of Field from the Match drop-down list.
6. Select either Up, Down, or All in the Search drop-down list.
7. Click Find Next to begin the search.
8. Click Find Next again to search for the next instance of the desired data.
9. Click Cancel to close the Find and Replace dialog box.
Let’s Try It!
|
What |
Why |
|
1. Click in the Title text box. |
Selects the field in which we wish to search for data. |
|
2. Click the Find button on the Ribbon as shown below. |
Displays the Find and Replace dialog box. |
|
|
|
|
3. In the Find What box, type: Sleepy Hollow. |
Enters the text that we wish to find. |
|
4. Click the Match drop-down list and then select Whole Field. |
Data must match exactly what we typed in the Find What box. |
|
5. Click Find Next. |
Begins the search and finds the first record matching our criteria. |
|
6. Click Cancel. |
Closes the Find and Replace dialog box. |
|
7. Click the form’s Close button. Save any changes. |
Closes the form. |
|
8. Click the File tab on the Ribbon and select Close from the File Options menu in Backstage View. |
Closes the Video Sales 5 database. |
Lesson Summary – Creating Forms
· In this lesson, you learned how to create a form using the Form Wizard. You learned that you can base your forms upon either queries or tables.
· Next, you learned how to enter data into a table in Form view. You learned that the Tab key moves you from one field on your form to another.
· Next, you worked with the Design view of a form. You learned that Design view consists of a Detail section, Form Header and Form Footer. You also learned about controls such as text boxes, labels and list boxes. You learned that you can switch to Design view by right-clicking the form you want to view and selecting Design View from the contextual menu, or by double-clicking the form to open it in form view, clicking the View button arrow and choosing Design View. You can also click the Design View button on the lower-right corner of the Access window.
· Next, you learned how to add a field to a form by clicking the Add Existing Field button on the Ribbon to display the Field List pane and then either dragging the desired field from the Field List pane to your form, or double-clicking the desired field.
· Next, you learned how to change the look of a control by modifying its properties from the Property Sheet dialog box. To display the Property Sheet box, select the object and then click the Property Sheet button under the Tools command set on the Ribbon or right-click the control and choose Properties from the contextual menu.
· Next, you worked with Layout view, from where you can change the design of the form while viewing your actual data. To display a form in Layout view, click the arrow on the View button in the Home tab and choose Layout View or right-click the desired form and choose Layout View from the contextual menu.
· Lastly, you learned how to Find and Replace data in a form by clicking the Find button under the Home tab.
Lesson 5 Quiz
1. Under which command tab can you find the commands to generate a form with the Form Wizard?
A. Forms
B. Create
C. Wizards
D. Database Tools
2. Under what tab can you find commands to modify the font style of your form?
A. The Font tab
B. The Layout tab
C. The Design tab
D. The Format tab
3. To search for specific data in your form, click the:
A. Search Records button
B. Find button
C. Replace button
D. Search button
4. You can base a form off of either a query or a table.
A. True
B. False
5. How can you add a new record to a form?
A. Click the New Record button on the form.
B. Click the Next Record button on the form.
C. Click the New Record command button on the Ribbon.
D. Right-click and select New Record from the contextual menu.
6. Which of the following is NOT a section in the Design view of a form?
A. Detail section
B. Form Header
C. Form Layout
D. Form Footer
7. You are in Datasheet view and wish to switch to Design view. How can you accomplish this (select all that apply)?
A. Right-click the form you want to view and select Design View from the contextual menu.
B. Click the View button arrow under the Home tab and choose Design View from the list.
C. Double-click the form name in the Navigation pane.
D. Click the Design View button on the lower-right corner of the Access window.
8. In which of the form views can you modify the layout of a form (select all that apply)?
A. Form View
B. Layout View
C. Datasheet View
D. Design View
9. From Design view, you want to display the properties for a text box. Name two ways you can accomplish this.
10. You can add a field to a form from the:
A. Property Sheet dialog box
B. From the Fields tab on the Ribbon
C. From the Fields List pane
D. From the Table Fields dialog box
11. You can rearrange fields on your form when in Form view.
A. True
B. False
12. Which view allows you to view your actual data while being able to rearrange the fields on your form?
LAB 5 – ON YOUR OWN
1. Open the Lab5 database in the Lesson Files folder.
2. Using the Form Wizard , create a new form based on the qryCustomers query.
3. Add the following fields to the form:
Customer ID
FirstName
LastName
Address
City
State
Zip
4. Choose the Columnar layout.
5. Name the form frmCustomers.
6. Create a new record and then enter your own information into the form.
7. Switch to Design View and then click the Maximize button. Display the properties for the Zip field (make sure to select the text box, not the label) and then change the Font Size property to 10.
8. Switch to Form View. Using the Find feature, search for any customers whose last name is Nolan.
9. Switch to Layout view. Delete the CustomerID field from the form.
10. Save and close the form. Close the database.
Access 2016 Level 1 30
© 2016 PCM Courseware, LLC 29