You use wildcards in your queries when you know only part of a value. For example, say you need to find the engineers in your company, but not everyone is called simply "engineer". The titles might be Engineer II, Quality Engineer, and so on. To find all instances of "engineer" you can use wildcards.
Wildcards can also help you retrieve data that matches a pattern. For example, you can find everyone on the 1000 block of Park Street.
Let's start by looking at the wildcard characters Access provides, and what those characters do.
The asterisk (*
) finds any characters located before, after, or inside of a criteria that you specify. The picture shows you one way to use it.
The question mark (?
) matches any single alphabetic character.
Square brackets (
) allow you to be more selective than the question mark. Your result set will include any characters you place inside the brackets.
The exclamation point (!
) tells a query to ignore any characters enclosed in brackets.
The dash (-
) matches a range of characters. Remember to specify your characters in ascending order — from A to Z, not Z to A.
The number or pound sign (#
) matches any single numeric character.
The rest of this course shows you how to match these wildcard characters. Remember that you use a different set of wildcards when you query a Microsoft SQL Server database, and the Quick Reference Card at the end of this course provides a list of those characters.