Condtional Format on a datasheet form with multiple criteria, boolean

DutchKevin

Board Regular
Joined
Apr 13, 2011
Messages
133
Office Version
  1. 365
Platform
  1. Windows
Hello,

I try to get this conditional formatting going on a datasheet form on which I display a query result. However it's not working properly with the OR criteria.
If Field1 equals 5 and the Description is un-equal to either textvalue, it should get a defined format.

Somehow it takes only the first check ito account, Field1=5
Can you suggest how this should work?

[Field1]=5 AND ([Description]<>"text1" OR [Description]<>"text2")

Thanks for Helping.

Kevin
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You could try
[Field1]=5 AND NOT ([Description]= "text1" OR [Description] = "text2")
 
Upvote 0
Hello Jack
This seemed to work. I'm a bit puzzled why <> did not work. But never the less, I'm happy.

Thanks
Kevin
 
Upvote 0
Hi Kevin,

you should be using AND not OR ... if 4 <> 3 or 4 <> 4 will be always be true

the method you posted should work if you use nz([Description],"") <> "Text1" AND nz([Description],"") = "text2"

if a value is blank, there is nothing to compare to. Null is NOT a value and cannot be compared to one.
NZ converts Null to a value so it CAN be compared. I usually specify the optional second argument although it is not necessary

btw, Description is a reserved word and should not be used for a name

Problem names and reserved words in Access by Allen Browne
Microsoft Access tips: Problem names and reserved words in Access
 
Upvote 0
Hello Chrystal,

I'm sorry i was not sooner in thanking you for your addition to the case.
So far i've not been able to get it working (also limited by the available three Conditional Formats in Access2007)
Due to holiday season I will cary this one over to next year and see if we can find new inspiration then :)

I wish everybody happy holidays !!

Best Regards
Kevin
 
Last edited:
Upvote 0
you're welcome, Kevin

in Access 2010, you can add up to 50 conditional formatting rules for each object ... that could be inspiring :)
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,772
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top