Hello David.
> Is it possible to use the "Like" function in an expression
> for a conditional formatting rule.
[quoted text clipped - 4 lines]
> additional information concatenated onto it that changes, and I would
> like the field to be blue for value X and green for value Y.
Should be possible, using "expression is" and an expression like:
[myfield] Like "*X*"

Signature
Regards,
Wolfgang
Hi David,
I don't think you need the Like function to change the format, you need to
determine the value in the field and then change the color accordingly. I
hope this is what your looking for.
Private Sub Form_Current()
If Left(Me.txtField, 1) = "x" Then
Me.txtField.ForeColor = RGB(0, 0, 255)
ElseIf Left(Me.txtField, 1) = "y" Then
Me.txtField.ForeColor = RGB(0, 255, 0)
Else
Me.txtField.ForeColor = RGB(0, 0, 0)
End If
End Sub
Note that:
- You need to replace [txtField] with your own field's name;
- The text color is changed with this, to change the background color you
need to use BackColor;
- You can also put this code in the in the AfterUpdate event of your text
field.
Good luck,
Philo
>Hi folks,
>
[quoted text clipped - 9 lines]
>
>Thanks - David
Daveo - 08 Aug 2005 06:25 GMT
Wolfgang - I can't seem to get the syntax right. I'm entering
[txtSatStatus] = Like "*Coen*" and get an invalid syntax error.
Philo - I'll probably go for your option, but need to use the Like
function or similar. E.g. The field may contain "Project X - Coen" or
"Coen - XXXXXX" and I need the field to go a certain colour if any part
of it contains the work "Coen". Could you show me how to modify your
code to do that please?
Thanks for the help - David
Duane Hookom - 09 Aug 2005 05:39 GMT
Remove the "=" when using "Like".
[txtSatStatus] Like "*Coen*"

Signature
Duane Hookom
MS Access MVP
> Wolfgang - I can't seem to get the syntax right. I'm entering
> [txtSatStatus] = Like "*Coen*" and get an invalid syntax error.
[quoted text clipped - 6 lines]
>
> Thanks for the help - David
Daveo - 09 Aug 2005 07:34 GMT
Thanks Duane - after hours of fiddling I tried that and it worked!!
David