Solved

vba filter not working on OR

Posted on 2013-01-06
3
213 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 39

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now