Display report criteria in a report

Microsoft Office Access 2003

Show All Show All

Display report criteria in a report

  1. Do one of the following:
  2. Open the report in Design view.

  3. For each parameter, add a text box by clicking the Text Box tool Button image in the toolbox, and then clicking where you want to place it.
  4. Click Properties Button image on the toolbar to display the property sheet for the text box.
  5. Do one of the following:

    In an Access database, set the ControlSource property for the text box to the parameters you specified in the Criteria cell in the query.

    ShowExample of setting the ControlSource property to one or more parameters in an Access database

    If the parameters in the query are:

    Between [Type a beginning date] And [Type an ending date]

    and you want to display them in two text boxes, set the ControlSource property of one text box to:

    [Type a beginning date]

    and the ControlSource property of the other text box to:

    [Type an ending date]

    If you want to display both parameters in one text box, you can use an expression in the ControlSource property box; for example:

    ="Between " & [Type a beginning date] & " and " & [Type an ending date]

    In an Access project, set the report's InputParameters property to a string that specifies the parameters that are passed to the stored procedure that the report is bound to. Then set the ControlSource property of the text box to a string that specifies the parameters in the stored procedure, any text you want to include, and the prompt text enclosed in square brackets.

    ShowExample of setting the report and text box properties in an Access project

    If the parameters in the query are:

    Between [Type a beginning date] And [Type an ending date]

    The string you assign to the InputParameters property must be an expression that includes the parameters you specified in the stored procedure or user-defined function and the text you want to appear in the prompt; enclose the prompt text in square brackets ([ ]):

    @Beginning_date datetime = [Beginning Date], @Ending_date datetime = [Ending Date]

    Then set the ControlSource property of the text box as shown in the following example:

    ="Sales from "& [Beginning Date] &" to "& [Ending Date]

  6. To see the criteria, print or preview the report. Microsoft Access displays the parameter values exactly as you typed them in the prompt.

Note  The Employee Sales by Country report in the Northwind sample database prints the criteria in the report header. To view this report, point to Sample Databases on the Help menu, click either Northwind Sample Database or Northwind Sample Access Project, and then open the Alphabetical List of Products report in Design view.