Hack #26. Be Tab-Smart

Override a form's tab order so that users get to the entry boxes they need.

Setting the tab order is probably not the biggest thing on your mind when you design a form. It doesn't really require much planning or analysis.

Typically, you do it at the end, after all the controls are in place. To be honest, at times I've simply forgotten to set a tab order on my forms. But, of course, the user community lets me know when that happens.

So, I started thinking that if tab stops on a form are really important to users, why not go one step better and make the tab order work more intelligently. On some forms only some boxes receive entries. A smart way to tab through a form in this situation is to sense which entry boxes can be skipped.

This makes sense when the condition or entry into a text box is based on some understandable logic flow. For example, if you're entering information about a new customer, usually you fill in every field. However, when you're entering a piece of information on an existing customer, most likely you tab over several text boxes.

Figure 3-24 shows a form in which a selection has been made from a combo box. The combo box, named Status, has four choices: Enrolled, Walk-In, Phone, and Renewal.

In the Exit event of the combo box, a Select Case statement sets the focus to different form controls, depending on the selection made in the combo box. For example, a status of Walk-In is used for unregistered people who come in without an appointment. ...

Get Access Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.