|
 |
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 |
 |
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  |
|
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

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

|
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
|
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]
|
 |
  |
Test your query - in the toolbar, click Run 
Query boxes open asking for the Beginning date (type 1902) and the Ending date (type 1912) |
 |
The query returns a list of authors and books published between 1902 and 1912.
Click on the Design View button in the toolbar to return to the Design View
Or close the query. |
|
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 |
 |
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 |
|
In Criteria in the Author column, type:
Like "*" & [Title contains word or partial word] & "*" |
|
Test your query - in the toolbar, click Run  |
 |
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 |
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 View button. |
|
SearchAuthor Query:
Like "*" & [Author to find:] & "*"
Note: this string is run in two fields using OR to join the criteria |
|
SearchTitleOrSubject:
Like "*" & [Enter title or subject search string:] & "*"
|