Advanced Database – Create, modify, run a two variable parameter query.

To add a second variable, open up the same query as we used in the last example.

35 two variable paramenters

In the third column, choose Staff Number field and type :Staff into the Criterion section.

This will set up a second parameter for the staff number.

Notice that Visible is unchecked for both the Car Reg No and Staff Number. This prevents these fields from being repeated in the query table. Press F5 to run query.

36 two variable input

This time, there are two parameters to input.

Enter a Car Reg No (e.g. GF54BLL) then click on Staff or Next and enter a Staff Number (e.g. 109)

37 two paramenter query

The query table returns only the records that contain the two variables inputted.

Two is the maximum permitted number of parameters in a query.

Parameter queries are useful for queries that you run regularly, where the only thing changing is the selection criteria for one or two fields.