Databases Reference
In-Depth Information
Modify the first expression using the CInt() function, and place parentheses around the field expression.
Some value comparisons don't resolve data types correctly. If such a comparison results in a data type
conversion or casting error, it can be corrected by explicitly converting the expression to the correct data
type, as you've done here with the field expression to explicitly convert it to an integer. To be on the safe
side, you can use Visual Basic-type conversion functions with any expression or value. See Figure 5-33.
Figure 5-33
The Filters expression builder has an interesting feature. The And/Or column doesn't allow an explicit
selection to be made. It will automatically set the logic to Or only when a redundant expression is used
with a different value. If you want to use a more complex expression (for example, if you wanted to
bring back all products for a category if no subcategory was selected), you can enhance the expression
manually as a single expression. However, it would be very difficult to do this line by line using this
tool. For more information about advanced filtering techniques, take a look at Chapter 6.
Finally, switch to the Layout tab, and open the Report Parameters dialog from the Report menu.
Associate the SubcategoryID and CategoryID parameters with their corresponding data sets as we've
done in previous exercises. Make sure that these parameters are listed in this order.
You have the opportunity to filter data in several different places, so plan carefully
when you intend to use report filtering. For example, if you created a report with a
grouped table and a chart, you would be able to define filters for the data set, the
table, the table group, and the chart. As a rule, I recommend defining report filters
in the data set unless you have a compelling reason to do it elsewhere.
Now that you have the data sets and parameters set up, you can actually create a report. We'll keep it
simple. In the Layout tab, drag a text box to the report body, click on it to set focus, and type the report
title Products by Category/Subcategory . Add a table to the report just below the text box and stretch it
to fill the width of the report.
Search WWH ::




Custom Search