Word Doesn't Give AND Rule Precedence in Query

Last reviewed: February 5, 1998
Article ID: Q144155
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1

SYMPTOMS

When you create a query that specifies a combination of rules that contain both AND and OR rules, Word processes the rules sequentially instead of processing the set of rules using AND before the set of rules using OR. The "Microsoft Word User's Guide," version 6.0, incorrectly states the following:

   ...You can use AND and OR separatly or in combination. In sets of rules
   that contain both AND and OR, rules connected by AND have precedence
   over rules connected by OR. This means that the set of rules connected
   by AND is used to select records before the set of rules connected by
   OR....

For example, if you create the following query to select all records from the city of Portland AND the state of Oregon OR the city of Salem AND the state of Oregon, your query will incorrectly select records for the city of Salem only.

Query                                   Word processes this result
-----                                   --------------------------

    State (Is) Equal to Oregon
AND City (Is) Equal to Portland         Oregon Portland
OR  State (Is) Equal to Oregon          Oregon
AND City (Is) Equal to Salem            Salem

Word should process the query like this:

Query                                   Word processes this result
-----                                   --------------------------

    State (Is) Equal to Oregon
AND City (Is) Equal to Portland         Oregon Portland
OR  State (Is) Equal to Oregon          Oregon Salem
AND City (Is) Equal to Salem            Salem Oregon
Portland Oregon

STATUS

Microsoft has confirmed this to be a problem in the version of Microsoft Word listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

Re-create the query using the structure in the following table.

Query                                   Word processes this result
-----                                   --------------------------

    City (Is) Equal to Portland
OR  City (Is) Equal to Salem            Both Cities From Any State
AND State (Is) Equal to Oregon          Both Cities Only
From Oregon

REFERENCES

"Microsoft Word User's Guide," version 6.0, page 669

"Microsoft Word User's Guide," version 6.0, page 697


KBCategory: kbusage kbmerge kbdocerr
KBSubcategory:

Additional query words: 6.0 6.0a 6.0c macword winword ntword 7.0
7.0a 7.0b 6.01 word95 word7 documentation error incorrect wrong
inaccurate inaccurately incorrectly false mail merge mailmerge


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.