Absolute Beginner's Guide to MicrosoftR Access 2002
In Chapter 6, you learned how to sort and limit the results of a query. You can also sort and limit data in a form, we'll show you how to do so in this section. Sorting Records in a Form
Do you remember setting the sort order for a query in Chapter 7? In the design grid, you selected Ascending, Descending, or None in a field's Sort cell. When you ran the query, Access presented the records in the appropriate order. Sorting in a form is very similar, but there's no Sort cell .
Tip
Let's look at a quick example using your Plants form. The form sorts the records by the CommonName field because that field is the primary key for the Plants table. When you assign a primary key, Access automatically defines an index for that field and an index sorts the data according to the field's data type. For instance, if the field is text, the data sorts alphabetically . Let's temporarily rearrange your plant records by sorting them by their LatinName entries. To do so, follow these steps:
Caution
Sort orders are temporary, unless you save the sorted form. In that case, Access remembers the new sort order the next time you open the form. To remove a temporary sort you've saved, select Remove Filter/Sort from the Records menu. Using Filter by Selection
The Filter by Selection feature in forms is similar to the table feature you learned about in Chapter 5, "Building Your First Tables." You simply select a control and apply the filterAccess does the rest. The main difference is that the Filter by Selection feature limits the records it displays by eliminating all records that don't match the entry in the current control.
Tip
Now, let's suppose you want to browse only the decorative plants. To do so, follow these steps:
Notice that the navigation bar has updated the number of records. Specifically, there's a total of five records instead of eight. In addition, the toolbar now displays the text ( Filtered ). That way, you know you're looking at an incomplete set of records. To remove the record, click the Remove Filter button or select Remove Filter/Sort from the Records menu. Do that now to return your form to normal. Using Filter by Form
The Filter by Form feature is similar to the Filter by Selection feature but more complex. Using this feature, you can specify the actual value that Access will attempt to match, instead of relying on existing data. You can also refer to more than one control. Let's illustrate this filtering feature by finding the medicinal plants you purchased from Wildseed Farms. Do the following:
The filtered set contains only one recordPurple Coneflower. To remove the filter, click the Remove Filter button on the Form view toolbar or select Remove Filter/Sort from the Records menu. Remove the filter now.
Note
Using the Find Dialog Box
So far, you've sorted and filtered. You can also search for a particular value in a record using the Find dialog box. This feature is similar to the Filter by Selection feature, but it doesn't filter the results and all the records are still available to you. Let's use this feature to find the record for purple coneflower. Follow these steps:
The record you see in Figure 8.22 might not be the only record that matches your entry. In this case it is, but if it weren't, you'd click Find Next again to see the next matching entry and continue doing so until you found the record you were searching for. Close the Find and Replace dialog box when you're done searching. The Find and Replace feature lets you qualify a search by specifying the field you're searching, specifying just how much of the entry you want to consider, determining the direction of the search, matching the letter case, and considering any formatting.
Note
|