msim
msim

Reputation: 363

How to apply a user-specified criteria to multiple fields in an Access query?

I'm working in Access 2007. I want make a query where the user is prompted to enter a date, and the date they enter becomes the criteria for multiple date fields in the query. I only want them to have to enter the date once, not once for each field. Is this possible? How?

Upvotes: 1

Views: 1041

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123474

If you have a query parameter that will be used in several places then you should declare it in the Parameters dialog within the Access query builder

Ribbon.png

In there you can define the parameter's "name" (which is also the prompt text) and data type.

ParamDialog.png

Once that is done, Access recognizes the parameter and offers it in IntelliSense prompts when building the rest of the query:

IntelliSense.png

When the user runs the query they will only be prompted to "Enter the Start Date:" once, even if that parameter is used in multiple places within the query.

Upvotes: 3

Related Questions