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.
Microsoft Access

Avatar of undefined
Last Comment
PeterBaileyUk

8/22/2022 - Mon
als315

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
IrogSinta

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
PeterBaileyUk

ASKER
nice solution thx
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck