Solved

vba filter not working on OR

Posted on 2013-01-06
3
220 Views
Last Modified: 2013-01-07
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.
0
Comment
Question by:PeterBaileyUk
3 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38750006
You can't use OR with <>
Try to change OR to AND

For example A <> 2 OR A <> 1 will always be true
0
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 38750430
As Alex said, you can change your ORs to ANDs, or you can use this:
Me.Form.Filter = "[Body type] NOT IN('Estate', 'MPV', 'Hatchback', 'Saloon', 'Roadster')"
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 38751343
nice solution thx
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question