conditional formatting

A

angie

there is a limit of 3 conditions so i have tried to use the following
expression to format my control box according to the value of another control
box:

iif([another control box name] like "value1" and "value2" and "value3";1;0)
but it does not work properly, i get the desired format only when the other
control box contains "value1".

i need your help!
 
D

Duane Hookom

The expression from the Conditional Formatting should evaluate to either
True/-1 or False/0. "Like" is generally used with wildcards to match one
value with part of another value. " and " is used to further filter a
condition. In your expression, one value can't equal "value1" AND equal
"value2". It might equal one OR the other.

I'm not sure that is what you want. I'm not sure if you can use "IN ( )" in
conditional formatting but you might be able to change your expression to:

=([another control box name] = "value1" OR [another control box name] =
"value2" OR [another control box name] = "value3")
 
A

angie

conditional formatting does not work, so i used code instead.

i have entered the following code in the OnFormatEvent of the Detail section:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.category
Case "A"
Me.client.BackColor = 12632256
Case "B"
Me.client.BackColor = 12632256
Case "C"
Me.client.BackColor = 12632256
Case Else
Me.client.BackColor = 16777215
End Select

Select Case Me.category
Case "dat"
Me.client.FontUnderline = yes
Case Else
Me.client.FontUnderline = no
End Select

End Sub

but i get the formatting only with the back color, not with the font
underline. have i done something wrong with the code?

Ο χÏήστης "Duane Hookom" έγγÏαψε:
The expression from the Conditional Formatting should evaluate to either
True/-1 or False/0. "Like" is generally used with wildcards to match one
value with part of another value. " and " is used to further filter a
condition. In your expression, one value can't equal "value1" AND equal
"value2". It might equal one OR the other.

I'm not sure that is what you want. I'm not sure if you can use "IN ( )" in
conditional formatting but you might be able to change your expression to:

=([another control box name] = "value1" OR [another control box name] =
"value2" OR [another control box name] = "value3")
--
Duane Hookom
Microsoft Access MVP


angie said:
there is a limit of 3 conditions so i have tried to use the following
expression to format my control box according to the value of another control
box:

iif([another control box name] like "value1" and "value2" and "value3";1;0)
but it does not work properly, i get the desired format only when the other
control box contains "value1".

i need your help!
 
D

Duane Hookom

If your underline code was compiled, I would expect to see yes and no to be
Yes and No. I doubt yes and no have values in vba. Change them to True and
False or -1 and 0.

--
Duane Hookom
Microsoft Access MVP


angie said:
conditional formatting does not work, so i used code instead.

i have entered the following code in the OnFormatEvent of the Detail section:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Me.category
Case "A"
Me.client.BackColor = 12632256
Case "B"
Me.client.BackColor = 12632256
Case "C"
Me.client.BackColor = 12632256
Case Else
Me.client.BackColor = 16777215
End Select

Select Case Me.category
Case "dat"
Me.client.FontUnderline = yes
Case Else
Me.client.FontUnderline = no
End Select

End Sub

but i get the formatting only with the back color, not with the font
underline. have i done something wrong with the code?

Ο χÏήστης "Duane Hookom" έγγÏαψε:
The expression from the Conditional Formatting should evaluate to either
True/-1 or False/0. "Like" is generally used with wildcards to match one
value with part of another value. " and " is used to further filter a
condition. In your expression, one value can't equal "value1" AND equal
"value2". It might equal one OR the other.

I'm not sure that is what you want. I'm not sure if you can use "IN ( )" in
conditional formatting but you might be able to change your expression to:

=([another control box name] = "value1" OR [another control box name] =
"value2" OR [another control box name] = "value3")
--
Duane Hookom
Microsoft Access MVP


angie said:
there is a limit of 3 conditions so i have tried to use the following
expression to format my control box according to the value of another control
box:

iif([another control box name] like "value1" and "value2" and "value3";1;0)
but it does not work properly, i get the desired format only when the other
control box contains "value1".

i need your help!
 

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