Representing Text Values

Finally, we turn to those controls of last resort, text boxes. Text boxes aren't evil; they're just overused. Most data in a typical database is textual, and text boxes are the appropriate controls for representing those values. The exception is when the field is a foreign key, in which case a combo box or list box is usually a better choice, as described earlier.

The basic principles of choosing controls apply equally to text boxes: use them when they match the users' mental model, and employ whatever data limitation techniques are possible.

Data limitation is provided in Access by the Input Mask property of the text box control and by the MaskedData control in Visual Basic. Both features allow you to specify a pattern that controls the form of data entered. An American social security number, for instance, follows the pattern ###-##-#### (three digits, a dash, two digits, a dash, and four digits).

Input masks are useful in certain situations, but unfortunately these situations are infrequent, and it's easy to limit the data entry too much. Phone numbers are a good example: it's tempting to use an input mask for these values, but before doing so you must make sure that the system needs to accept phone numbers only from within the same country. Phone numbers in different countries often do not have the same format. Even within a single country, you need to think about possible variations—extensions and access numbers, for example.

Remember, your goal in providing an input mask is to make life easier for users. Preventing them from entering perfectly valid—but unexpected—values is a hindrance.

In addition to standard text boxes, both Access and Visual Basic support using a Microsoft Rich Textbox control for entering text that combines different typefaces and styles. Implementing a Rich Textbox control is more complex than using other controls because you must also provide an interface for setting the text properties.

In addition to the added complexity in the interface, a Rich Textbox control also adds some complexity to the data manipulation, since the text formatting is embedded in the control. For this reason, I recommend restricting the use of Rich Textbox controls to situations in which the added functionality is of tangible benefit to users. Furthermore, you should use them only for values that will be treated as "chunks" of text that are displayed in various places but are not searched or joined with other values.

For example, rich text can be useful for managing boilerplate paragraphs of text that are combined to produce standard letters. The actual paragraphs to be included would be stored as rich text but chosen by users on the basis of descriptive or categorical information stored as standard, unformatted text.



Designing Relational Database Systems
Designing Relational Database Systems (Dv-Mps Designing)
ISBN: 073560634X
EAN: 2147483647
Year: 1999
Pages: 124

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net