Share this Page URL

Chapter 8. Adding Features and Function ... > Handling Unexpected Behavior in a Fo... - Pg. 298

Adding Features and Function to Forms 298 Locking a control If you don't want a control to be available but you also don't want it to appear dimmed as it does when its Enabled property is set to No (or False), set the control's Locked property to Yes and the Enabled property to Yes. This way, the control appears as it would when it's enabled, but the control can't receive the focus. Handling Unexpected Behavior in a Form When you use Visual Basic to automate some or all of a form's operations, you might run into situations when you--or, more likely, a user who isn't familiar with the design of the form--see results you don't expect. In the case of the ExpenseViews form, what happens if you click View Expenses without having selected a value in either the Expense Categories or the Campaigns list box? You'd see a blank datasheet like the one shown in Figure 8-1. Although this situation is part of the specific database project we're demonstrating, situations like it occur in almost any database you create.