Link to home
Start Free TrialLog in
Avatar of PeterBaileyUk
PeterBaileyUk

asked on

vba filter not working on OR

I have this filter :
Me.Form.Filter = "[Body type]<>'Estate' OR [body type]<>'MPV' OR [body type]<>'Hatchback' Or [body type]<>'Saloon' Or [body type]<>'Roadster'"

The syntax appears ok however i get records showing within the exclusions.

if i do this Me.Form.Filter = "[Body type]<>'Estate' it will exclude the group.
Avatar of als315
als315
Flag of Russian Federation image

You can't use OR with <>
Try to change OR to AND

For example A <> 2 OR A <> 1 will always be true
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PeterBaileyUk
PeterBaileyUk

ASKER

nice solution thx