Providing an alias for the field name

To make the query datasheet easier to read, you can provide aliases for the fields in your query. An alias becomes the field’s heading in the query’s datasheet, but does not affect the field’s name or how the data is stored and used by Access. Aliases are sometimes useful to help users better understand the data returned by a query. Data in queries are often transformed by performing simple operations such as combining a person’s first and last name as a single field. In these situations, aliases are very useful because they provide an easily recognizable reference to the transformed data.

To follow along with this example, create a query using the fields from the tblProducts. Follow these steps to establish an alias for the ProductID and Description fields:

  1. Click to the left of the P of the ProductID column in the top row of the QBE grid.
  2. Type Product-Number followed by a colon (:) to the left of ProductID.
  3. Click to the left of the D in the Description column and enter Product Description: to the left of the field name.

When you run the query, the aliases you created appear as the column headings. Figure 36-14 shows both the query in Design view and the query’s datasheet. Notice that the ProductID and Description column sport their new aliases instead of their respective field names.

FIGURE 36-14
Aliases can be useful to help users understand data.

Aliases should be used with caution, however. Because an alias masks the name of the field underlying a datasheet, it’s easy to become confused which column headings are aliases and which are field names. It is a complete waste of time looking for a field named ProductDescription, based on a datasheet column heading. It would be nice if Access somehow distinguished between aliases and field names in Datasheet view, but the only way to know for sure is to examine the query’s design.

Add to Technorati Favorites


// Related Posted - GOOGLE!

Loading



Related Websites
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>