Lesson 16: Creating Forms Show /en/access2013/modifying-tables/content/ IntroductionCreating forms for your database can make entering data more convenient. When you create a form, you can design it in a way that works with your database and that makes sense to you. In this lesson, you will learn how to create and modify forms. You'll also learn how to use form options like design controls and form properties to make sure your form works exactly the way you want. Throughout this tutorial, we will be using a sample database. If you would like to follow along, you'll need to download our Access 2013 sample database. You will need to have Access 2013 installed on your computer in order to open the example. To create a form:Access makes it easy to create a form from any table in your database. Any form you create from a table will let you view the data that's already in that table and add new data. Once you've created a form, you can modify it by adding additional fields and design controls like combo boxes.
About subformsIf you created a form from a table whose records are linked to another table, your form probably includes a subform. A subform is a datasheet form that displays linked records in a table-like format. For instance, the subform included in the Customers form we just created displays linked customer orders. We probably don't need to include this subform because we just want to use the Customers form to enter and review contact information. If you find that you don't need a subform, you can easily delete it. To do this, simply click it and press the Delete key on your keyboard. An unnecessary subform in our Customers formHowever, subforms are often quite helpful. Depending on the content and source of your form, you might find that the subform contains useful information, like in the example below. In our Orders form, the subform contains the name, quantity, and price of each item contained in the order, which is all useful information. Our Orders form, which includes a useful subformAdding additional fields to a formWhen you use the Form command on an existing table, all of the fields from the table are included in the form. However, if you later add additional fields to the table, these fields will not automatically show up in existing forms. In situations like this, you can add additional fields to a form. To add a field to a form:
You can also use the above procedure to add fields to a totally blank form. Simply create a form by clicking the Blank Form command on the Create tab, then follow the above steps to add the desired fields. Clicking the Blank Form commandTo add a field from a different table:You can also add fields from different tables in your database to the form.
Adding design controlsDesign controls set restrictions on the fields in your forms. This helps you better control how the data is entered into your forms, which in turn helps keep the database consistent. Combo boxesA combo box is a drop-down list you can use in your form in place of a field. Combo boxes limit the information users can enter by forcing them to select only the options you have specified. Combo boxes are useful for fields that have a limited number of possible valid responses. For instance, you might use a combo box to make sure people only enter a valid U.S. state while entering an address, or that they only choose products that already exist in your database while placing an order. To create a combo box:
If you want to include a drop-down list with a long list of options and don't want to type all of them out, create a combo box and choose the first option in the Combo Box Wizard, I want to get the values from another table or query. This will allow you to create a drop-down list from a table field. A combo box that takes its values from a tableSome users report that Access malfunctions while working with forms. If you have a problem performing any of these tasks in Layout view, try switching to Design view. Customizing form settings with the Property SheetThe Property Sheet is a pane containing detailed information on your form and each of its components. From the Property Sheet, you can make changes to every part of your form, both in terms of function and appearance. The best way to familiarize yourself with the Property Sheet is to open it and select various options. When you select an option, Access will display a brief description of the option on the bottom-left border of the program window. Selecting a Property Sheet option to find out what it doesPay close attention as you modify your form and its fields. It's possible to make subtle changes with the Property Sheet. Because there are so many options, it can sometimes be difficult to remember which one you used to modify each aspect of your form. Modifying form settingsThere are far too many options in the Property Sheet to discuss them all in detail. We'll review two useful ones here: hiding fields, and setting fields with dates to automatically fill in the current date. Practicing these procedures should also give you a sense of how to work with other Property Sheet settings. To hide a field:
To set a field to autofill with the current date:
Challenge!
/en/access2013/formatting-forms/content/ What is a control in Access?Controls are the parts of a form or report that you use to enter, edit, or display data.
What is a control layout in Access?A layout, indicated by an orange grid around the controls, helps you align controls horizontally and vertically to give the form a uniform appearance.
How do you use controls in Access?To create a control that is bound to a field (meaning that the control will display and let you edit data from a table), open the Field List (Alt+F8) and drag the field from the list to the form, view, or report. Access adds a control that is appropriate for the type of data stored in the field.
How do you set a control property in form Design view?In form Design view or report Design view, select the control, section, form, or report for which you want to set the property. You can select: One or more controls. To select multiple controls, hold down the SHIFT key and choose the controls, or drag the mouse pointer over the controls you wish to select.
|