Works: Grouping Filter Conditions in a Works Database (136322)



The information in this article applies to:

  • Microsoft Works 6
  • Microsoft Works 2000
  • Microsoft Works 4.5
  • Microsoft Works for Windows 95, version 4.0

This article was previously published under Q136322

SYMPTOMS

When you attempt to use parentheses to group conditions together in an Easy Filter or filter-using formula in Microsoft Works 4.0 or later, the parentheses are deleted or treated as text when you exit the Filter dialog, and you receive the following error message:
The filter contains an error. Review the filter and makes changes if necessary, and then try again.

RESOLUTION

To resolve this issue, enclose the conditions that you want to evaluate first within AND() or OR() functions.

For example, to group two conditions together with a logical AND within a Filter formula, type a line similar to the following:

AND(condition1,condition2)

NOTE: Do not type a line similar to the following:

(condition1#AND#condition2)

Example Filter Formula

When you type the following filter formula

=LastName="Smith"#and#(FirstName="Margaret"#or#FirstName="Larry")

Works changes the formula to the following

='LastName'="Smith"#AND#'FirstName'="Margaret"#OR#'FirstName'="Larry")"

and you receive the error message described in the "Symptoms" section of this article.

To group the two FirstName conditions together correctly, use the OR() function. To do this, change the filter formula to match the following line:

=LastName="Smith"#AND#OR(FirstName="Margaret",FirstName="Larry")


Modification Type:MajorLast Reviewed:11/15/2004
Keywords:kberrmsg kbprb kbui KB136322