Using a Wildcard Character in Access Queries

Add a “wildcard” to your queries!

You can use a wildcard in a query in place of one or several characters. Wildcard characters are helpful when you want to find criteria with a pattern (such as all last names beginning with M), or if you are not sure exactly how values you want to find appear (such as the correct spelling—Kline or Klein).

 

The two most common wildcards are listed in the following table:

 

Wildcard Used for Example
? Any single letter or number Sm?th finds Smith and Smyth, whereas ?andy finds Sandy, Randy, etc.
* One or more letters or numbers M* finds all records that start with M; 8/*/00 finds all dates in August, 2000; and *ball* finds all records that have the text ball anywhere in the field

 

Step-by-Step

Use a wildcard character in a query.  Here’s the Datasheet View of the query prior to entering criteria – 53 records in the recordset.  The first column is Store Name:

Steps Practice Data
1.    Go to Query Design View.  Select the Criteria row of the desired field.
The insertion point appears in the corresponding Criteria row.
Click in the Criteria row of the Store Name field
2.    Type the desired criteria, using wildcards as appropriate.
The text appears in the Criteria row.
Type sport*
3.    Press [Enter].
The criteria is entered into the design grid.
Press [Enter]

 

Here’s the Design View for the query after typing sport* — notice Access enters the word “Like”:

Run the query. Notice that only 16 records matching the criteria appear in the recordset, each with the name “Sport” at the beginning of the record.

Questions? Contact us for more information or schedule a class for your team!