Red text or background if control contains a certain value?

C

CW

I have a datasheet form based on a query where one of the fields/controls is
concatenated (in the source query), displaying the invoice numbers for an
order and following each number, whether it has been paid or not. This can be
a combination of values e.g.
"7828 (Paid), 7844 (Not Paid)"
If the control contains an instance of (Not Paid) I would like either the
text or the background colour of the control (either would be fine) to be red.
I have tried using Conditional Formatting but could not work out how to
express if the field value "contains" (Not Paid) - it seems only to work with
equals, is greater than, etc etc.
I also thought about some code in a Current event for the form.
What is the best way to achieve this, please?
Many thanks
CW
 
T

Tom van Stiphout

On Fri, 29 Jan 2010 05:34:02 -0800, CW <[email protected]>
wrote:

Use conditional formatting.
Select "Expression Is"
For the expression write: InStr([myFieldWithInvoiceNumbers], "(Not
Paid)") > 0
(replace myObjectNames with yours)

-Tom.
Microsoft Access MVP
 
C

CW

Great - just what I needed!
Many thanks
CW

Tom van Stiphout said:
Use conditional formatting.
Select "Expression Is"
For the expression write: InStr([myFieldWithInvoiceNumbers], "(Not
Paid)") > 0
(replace myObjectNames with yours)

-Tom.
Microsoft Access MVP


I have a datasheet form based on a query where one of the fields/controls is
concatenated (in the source query), displaying the invoice numbers for an
order and following each number, whether it has been paid or not. This can be
a combination of values e.g.
"7828 (Paid), 7844 (Not Paid)"
If the control contains an instance of (Not Paid) I would like either the
text or the background colour of the control (either would be fine) to be red.
I have tried using Conditional Formatting but could not work out how to
express if the field value "contains" (Not Paid) - it seems only to work with
equals, is greater than, etc etc.
I also thought about some code in a Current event for the form.
What is the best way to achieve this, please?
Many thanks
CW
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top