Freedom Computers

ACCESS

Display Query criteria/parameters in a Report


Print the criteria for a report in the report header
In a Microsoft Access database (.mdb), create the criteria parameters in the report's underlying query. In a Microsoft Access project (.adp), create the parameters in the report's underlying stored procedure.


Open the report in Design view.


Create an unbound text box for each parameter you want to display. Click the Text Box tool in the toolbox, and then click in the report header.


To display the property sheet, make sure the text box is selected, and then click Properties on the toolbar.


Do one of the following:
In an Access database, set the ControlSource property to the parameter(s) you specified in the Criteria cell in the query. For example, 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. As in the following example, the string must be an expression that includes the parameters you specified in the stored procedure 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 control 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 as shown in the following example:

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