Conditional Formatting on Multiple Fields based on Two Criteria

Tophan

Registered User.
Local time
Today, 02:43
Joined
Mar 27, 2011
Messages
374
Hi,

I have a report which I would like to apply conditional formatting on multiple fields. I would like the conditional formatting to be based on two types of criteria

First criteria would be contracts that start with the year 2014. I used the following expression which worked - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Joseph Steinbok" or "Adam Godson")

To this expression I would also like to highlight fields which contracts start with 2014 AND have a particular Director assigned to it. For this I used the following expression - And [DirectorInCharge]="Name"

On their own, both expressions are working but I want to combine them. How do I do this? I’ve tried the following - InStr(1,[ContractNr],"2014" AND [DirectorInCharge]= "Name") but then nothing is highlighted. I also tried InStr(1,[ContractNr],"2014") AND [DirectorInCharge]= "Name" – in this instance EVERY record was highlighted.

Where am I going wrong?
 
Try,
Code:
InStr(1, [ContractNr], "2014) <> 0 AND [DirectorIncharge] = "Name"
 
Worked perfectly! Thank you :) Can you explain what the < > 0 did?
 
InStr function returns a Number. The position of the First occurrence of the Search string. So If it is 0, then the Expression will fail eventually. Irrespective of the DirectorInCharge being the same "Name". So adding <> 0, makes it the more correct way of evaluating the condition.
 

Users who are viewing this thread

Back
Top Bottom