Getting to Know Microsoft Access, Part 7: Forms - Customizing Your Form
(Page 4 of 4 )
Let’s return to our first form, the one we created in design view. This is how the form starts out if you don’t use one of the AutoForm’s or the Form Wizard; it’s blank. When you create a new, blank form you can either choose to incorporate a record source as you did with the form wizard, or you can choose not to use a record source at all. Why would you want to do that? Well, you might want a form that merely shows a course of action the user can take, not based on any underlying data. However, you’ll generally want to use underlying data in your forms, so choose a record source.
In addition to the bound text box controls you created when you dragged fields from the field list previously, you can create list and combo boxes for your form that allow the user to choose from a list of values. Both controls can be bound or unbound. The two controls are similar but generally you use a list box when you have a smaller choice of items and a combo box when you have many items to choose from. You can also add Yes/No controls such as check boxes and option buttons, as well as toggle buttons such as option groups. To add any of these controls just make sure the Control Wizard button is pressed and then make your selection in the toolbox.
Forms are used to input data into your tables in an attractive and easy manner. One of the ways to assist the user in accomplishing this task is to use command buttons that perform certain actions when clicked. Add a command button by simply clicking the command button control in the toolbox and then clicking in the form design to create the button. A dialog shows you available actions; select the action you want the button to perform and give your button a name. It’s as simple as that!
You add calculated controls to the form by inserting a control in the form and changing the control source property of the control, just as we did before. Just enter the expression you want to use on your underlying data into the control source property of the control beginning with an = sign. The following are some examples of expressions you might use:
=Count([Last Name])
Or
=Sum([Price]*[Quantity])
The first expression above counts the number of records with a value in the Last Name field. The second one shows the sum of the values in each record for the price of a particular item multiplied by the quantity of the product. If you’re having trouble building expressions in Access you can always use the Expression Builder by simply double-clicking the (…) button next to the control source property for a control and entering the data you wish to use in the expression, including the operators.
One final thing I would like to mention in this lesson is Active X controls. You can see what Active X controls are available to you by choosing the Tools | Active X Controls menu option. From there you’ll be able to add things such as calendars, spreadsheets, and even animation to your form design! Active X controls give you many exciting options for your form design. Have fun, and in next week’s lesson we’ll review reports.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |