Share this Page URL

Chapter 8. Adding Features and Function ... > Using an Option Group to Perform Alt... - Pg. 287

Adding Features and Function to Forms 287 3. in a situation such as this.) When the value of grpViewExpensesBy equals 1--meaning that Category is selected in the option group-clicking the View Expenses button opens the Cam- paignExpenses form, which is one of the forms we created for this chapter's examples. When the value equals 2 (Campaign is selected), the procedure runs the OpenQuery method and opens a query named qryExpenseReport. When Summary (the option assigned the value 3) is selected, the ExpenseSummary form is opened. (We chose to open a query in the second case only to demonstrate that distinct actions can be associated with different values. We could have opened a form in that case or performed some other operation.) Close the Visual Basic Editor, and then switch the ExpenseViews form to Form view. Select an option in the View Expenses By option group, and then click View Expenses. If you select Summary, you'll see the ExpenseSummary form, shown here: