inls 461
Information Tools

Professor: Serena Fenton
School of Information and Library Science at UNC-Chapel Hill

Parameter Queries

Parameter Search by one criteria (date)  
01

This is our Oldest Book: Select query.

We could modify this query to allow us to search for any particular year of copyright.

I copied the query and saved the copy as:
parameter: copyright date

02

Delete the >0 criteria (year) and replaced it with :
[Search for copyright date]

Note: the square brackets trigger the parameter behavior. The text is irrelevant. It is good to put in text that is informative for the user.

I could type:
[You've got dog breath] and it would still bring up a parameter box. Of course, the user wouldn't know to put in the date to search, so it would be worthless.

Test the query by running it run

03

The parameter query brings up an input box displaying the text between the [ ].

Enter 1968, and the query will return all of the books in the collection published in 1968

05

Click on the Design View button design in the toolbar to return to the Design View

04
Parameter Search with two criteria (between)

 

07

For this exercise, we'll modify the query Oldest Book

Open the books2003.mdb to the query window and right click on Oldest Book -> Copy

RIght Click anywhere in the Queries Window -> paste

 

08

Note: in a parameter the instructions (for the user) are placed within the square brackets [ ]
For this query, two parameters are joined by Between & And

Name this new query: parameter-between dates

Click OK

In the Query Design window, under the criteria for year:

  • delete: >0
  • insert: Between [Type the beginning date] And [Type the ending date]
06
0910

Test your query - in the toolbar, click Run run

Query boxes open asking for the Beginning date (type 1902) and the Ending date (type 1912)

11

The query returns a list of authors and books published between 1902 and 1912.

Click on the Design View button design in the toolbar to return to the Design View

Or close the query.


Parameter Search with Wildcards

This gives you the most options, as it will allow letters before or after the search string

Like "*" & [type prompt here] & "*"

Query -

Search with part of the title

14

Create a new query in Design View

Add the Authors and Books tables

From the Authors table, drag Author onto the design grid

From the Books table, drag Title onto the design grid

15

In Criteria in the Author column, type:

Like "*" & [Title contains word or partial word] & "*"

16
Test your query - in the toolbar, click Run run
17

The results show any Title with with word tale or tales (or any other variation containing the string 'tale'

Save query as:
parameter-wildcard Query

Parameter Query Examples

The books2003.mdb database has some examples of wildcard queries that are worth examining, Two are shown below. These both use OR to search two fields.

To open a parameter query in Design View, select the query in the Query window; click the design Design View button.
12

SearchAuthor Query:

Like "*" & [Author to find:] & "*"

Note: this string is run in two fields using OR to join the criteria

13

SearchTitleOrSubject:

Like "*" & [Enter title or subject search string:] & "*"

 

 


revised September 27, 2006