Conditional Formatting with Iif

djs

Registered User.
Local time
Today, 13:05
Joined
Aug 18, 2011
Messages
11
To make this as simple as possible lets say I have a report with 2 fields Field1 and Field2. What I want to do is if Field 2 is null then display Field 1 otherwise display Field2. I used the following code

Iif(IsNull([Field2]),[Field1],[Field2])

This did not do anything. Is it not possible to use the Iif statement in conditional formatting or am I typing somethin in wrong? Thanks.
 
Don't know why you are calling this conditional formatting, it looks like the sort of data selection that should be done in the reports source query

Brian
 
Also, the Nz() function would be simpler.
 
Well the report source is a table and the way the person had built this is a little screwy. It has several fields one is employee, one is training, and one is the year (so this year it would be 2013 but it contains past years). The Training and Employee already have data filled for example:

Training Employee 2011 2012 2013
xzy John

So when john completes training his name is placed under the year which he did the training. The info is entered onto a form and some update querys update the table. So if John does training for 2013 "John" will appear under 2013 but I was looking for a quick way for it to show "John" for any other year he did not complete the training in bold red or something. It is easy to see from above that he did not with only a couple fields but some of the other training dates back many years and with many more columns it gets confusing trying to follow names across the report. I thought an expression in the conditional formatting for the year field would be easiest, if something is in the field show it, if it is null then show the employee name in red. Maybe this is not the easiest way to go about this so if it is not then I will look for another way but before I do I just wanted to see if I was making some simple mistakes in my expression. Thanks.
 
Brian has probably gone to a pub. :p

That is a poor design. In Conditional Formatting an expression like:

IsNull([FieldName])

should work to highlight that field.
 
Ya very poor design but it is what I am stuck working with until I rebuild it but I modified the report a little and was able to use the IsNull() to help me do what I wanted to do. Thanks again for the help.
 
We were happy to help.
 

Users who are viewing this thread

Back
Top Bottom