Share this Page URL

Chapter 8. Adding Features and Function ... > Using a Control's Value in Query and... - Pg. 288

Adding Features and Function to Forms 288 Quick Check Q. What are the two ways you can use the value of an option group? A. You can store the value in a field or use the value to initiate another operation. Q. Which type of control is most often used in an option group? A. An option button. The Option Group Wizard lets you choose between an option button, a check box, or a toggle button. Applications that run on Windows use an option button (also called a radio button) most often. Using a Control's Value in Query and Filter Criteria In Chapter 6, "Sorting, Filtering, and Retrieving Data," you learned how to apply a filter to a set of records and how to define a parameter for a select query so that you could supply criteria to the query at run time. With the ExpenseViews form, we'd like to see detailed expenses not for all cat- egories or campaigns but for a specific category or campaign. We could filter the data ourselves when the form or query displaying expense records is opened, but we can also use a value gathered from a control on a form as the input for a query's parameter or a filter. In this section, we'll add two list boxes to the ExpenseViews form--one that lists expense categories and one that lists campaigns. We'll use the items in the list boxes as the input for a parameter and a filter. You'll learn how to create a list box (using another of the control wizards) and see how to refer to a form's control in the Criteria area of the query design grid. We'll move through the List Box Wizard's steps without much comment. The List Box Wizard requests the same information that the Combo Box Wizard requests. If you want a more detailed explanation of how to work with the wizard, see the procedure "Add a Combo Box to a Form," in Chapter 7.