Create a parameter query that gets criteria from a custom dialog box

Create a parameter query that gets criteria from a custom dialog box

You can use a custom dialog box to enter criteria for the query underlying a form, report, or Web page. For example, a custom dialog box can determine what records a printed report includes.

  1. Create or open the query that will collect its criteria values from the dialog box.

  2. Make sure that the query includes the tables you want to use.

  3. Add to the query design grid the fields associated with each of the dialog box controls where you'll enter criteria values. For each of these fields, enter an expression in the Criteria cell that tells Microsoft Access to refer to the control on the dialog box for the criteria values. If you need help creating the expression, use the Expression Builder. For more information, click .

  4. Add to the query design grid the fields whose values you want returned.

For example, you could create a dialog box form named Customer Info with a control for the CustomerID field. By entering a customer ID in the dialog box, you could have the query return the correct customer's company name, address, and city. To create this query, you'd do the following:

To read more about using forms to collect and display information, see "Using Forms to Collect, Filter, and Display Information" in Building Applications with Forms and Reports.