[ Team LiB ] Previous Section Next Section

Getting Help from the Expression Builder

The Expression Builder is a helpful tool for building expressions in queries as well as in many other situations in Access. To invoke the Expression Builder, you click the Field cell of the query design grid and then click Build on the toolbar. The Expression Builder appears (see Figure 10.22). Notice that the Expression Builder is divided into three columns. The left-hand column shows the objects in the database. After you select an element in the left column, select the elements you want to paste from the middle and right columns.

Figure 10.22. The Expression Builder.

graphics/10fig22.jpg

The example in Figure 10.23 shows Functions selected in the left column. Within Functions, both user-defined and built-in functions are listed; here, the Functions object is expanded with Built-In Functions selected. In the center column, Date/Time is selected. After you select Date/Time, all the built-in date and time functions appear in the right column. If you double-click a particular function—in this case, the DatePart function—Access places the function and its parameters in the text box at the top of the Expression Builder window. Notice that the DatePart function has four parameters: Interval, Date, FirstWeekday, and FirstWeek. If you know what needs to go into each of these parameters, you can simply replace the parameter placeholders with your own values. If you need more information, you can invoke Help on the selected function to learn more about the required parameters. Figure 10.24 shows two parameters filled in: the interval and the name of the field being evaluated. After you click OK, Access places the expression in the Field cell of the query.

Figure 10.23. The Expression Builder with the DatePart function selected and pasted in the expression box.

graphics/10fig23.jpg

Figure 10.24. A function pasted by the Expression Builder, with the parameters updated with appropriate values.

graphics/10fig24.jpg

    [ Team LiB ] Previous Section Next Section