OL: How to Use the Query Builder for View Filters and Advanced Searches

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry


This article discusses how to configure and use the Query Builder tool to create more advanced view filters and search criteria in Outlook 2002, Outlook 2000, and Outlook 98.

More Information

Query Builder is a feature available in Microsoft Outlook 98, Microsoft Outlook 2000, and Outlook 2002. Query Builder lets you define more complex criteria when you create a filter for a folder view or do an advanced search. The Query Builder also provides a more intuitive interface for users to configure filter or search criteria. When it is in use, Query Builder appears as a tab in the Advanced Find and Filter dialog boxes.

How to Turn On Query Builder

To turn on the Query Builder, add the QueryBuilder key to the registry.

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

To add the QueryBuilder key to the registry, follow these steps:

  1. Quit Outlook.
  2. Click Start, and then click Run.
  3. In the Open box, type regedit,and then click
  4. Locate the following key in the registry based on your installed version: Outlook 98

    Outlook 2002

  5. On the Edit menu, click New, click Key, and then type QueryBuilder for the key name.
  6. Quit Registry Editor.

How to Use Query Builder

The main purpose of the Query Builder tool is to provide more complex filters and search criteria than are normally possible with the options in the Filter and Advanced Find dialog boxes. For example, if you use the Advanced tab to do a query that has two entries that use the SAME field, the result is an OR condition:
To: contains string1
To: contains string2

This query returns any item that contains string1 or string2 in the To: line of an e-mail message. Although this method is not very intuitive, you can make this an AND query by entering the condition with the strings separated by a space, as shown:

To: contains string1string2
In Query Builder, this type of AND query can be done much more intuitively by adding the same field multiple times. Query Builder automatically generates an AND query. You can easily change this query to an OR query by selecting the appropriate value in the Logical Group list.

The following query is another example of a query that you can do only with Query Builder:

Subject is not empty
Subject does not contain value
This criteria will return all items where the Subject field contains data AND Subject does not contain the string specified by value.

How to Create Nested Conditions

With Query Builder, you can create nested conditions by using the Move Up and Move Down buttons. After you have added three or more fields to the criteria list, you can use the buttons to move the selected line up or down to create a nested condition. Nested conditions allow for much greater complexity and a finer level of control over the criteria.

ID do Artigo: 307922 - Última Revisão: 14/11/2003 - Revisão: 1