Conditional Formatting Again

L

Linda RQ

Hi Everyone,

I've looked around and so far I don't think I can have more than 3 items for
conditions for my control on my report and I also read that you can't have
wild cards for this but I thought I would give it a shot. There is a thread
below with my exact question from the 20th but I can only see part of the
thread. I was hoping I could perhaps work around the rule without using
code. My field is called TherapyType. I want the control shaded in grey if
these are the values.... "Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent". Is there some way to write an expression instead of using the 'If
Value is equal to' so I am not limited to just 3 conditions since Vent is
part of each therapy type?

Thanks,
Linda
 
M

M Skabialka

Select on the toolbar:
Format
Conditional formatting
Field Value is equal to "Vent"
Set your fill color to grey, then choose Add >> for the next field value.

Personally I think code is much easier to use in theis case as you can see
all of it at once to change tha values, color, etc:

In the after update event of the TherapyType, place code similar to this:

Private Sub TherapyType_AfterUpdate()
Select Case TherapyType
Case "Vent", "Vent NCPAP", "HFNC Vent", "Ossilator Vent"
TherapyType.BackColor = 12632256 'grey
Case Else
TherapyType.BackColor = 16777215 'white
End Select
End Sub

Hope that helps.
Mich
 
M

Marshall Barton

Linda said:
I've looked around and so far I don't think I can have more than 3 items for
conditions for my control on my report and I also read that you can't have
wild cards for this but I thought I would give it a shot. There is a thread
below with my exact question from the 20th but I can only see part of the
thread. I was hoping I could perhaps work around the rule without using
code. My field is called TherapyType. I want the control shaded in grey if
these are the values.... "Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent". Is there some way to write an expression instead of using the 'If
Value is equal to' so I am not limited to just 3 conditions since Vent is
part of each therapy type?


Instead of using the Field Value Is: option, select the
Expression Is: option.

Then use:
[TherapyType] IN(Vent", "Vent NCPAP", "HFNC Vent",
"Ossilator Vent")
 
F

fredg

Hi Everyone,

I've looked around and so far I don't think I can have more than 3 items for
conditions for my control on my report and I also read that you can't have
wild cards for this but I thought I would give it a shot. There is a thread
below with my exact question from the 20th but I can only see part of the
thread. I was hoping I could perhaps work around the rule without using
code. My field is called TherapyType. I want the control shaded in grey if
these are the values.... "Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent". Is there some way to write an expression instead of using the 'If
Value is equal to' so I am not limited to just 3 conditions since Vent is
part of each therapy type?

Thanks,
Linda

Use:

Condition1
Expression Is
[TherapyType] In("Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent")


Alternatively....
If the [TherapyType] control is in the Report's detail section, for
example, code the Detail Format event:

If [TherapyType] = "Vent" or [TherapyType] = "Vent NCPAP" or
[TherapyType] = "HFNC Vent" or [TherapyType] = "Ossilator
Vent" Then
[TherapyType].BackColor = 12632256
Else
[Thera[yType].BackColor = vbWhite
End If

You could also use Select Case.
 
L

Linda RQ

Thanks, Fred and all others that replied...The Conditional Expression
worked! I will keep this code below for later. I am just not ready to use
code yet. I have tried it before but since I don't really understand it, if
it stops working, I can't fix it by myself so I shy away for now. I predict
I'll start using it pretty soon though....Maybe.<g>

Linda

....Hmmm, I wonder why all my searching came up with....You can only set 3
conditions. I guess searches are like Romulans, when questions are asked,
they answer the question only and don't offer any additional information. I
am glad this is a Federation group.


fredg said:
Hi Everyone,

I've looked around and so far I don't think I can have more than 3 items
for
conditions for my control on my report and I also read that you can't
have
wild cards for this but I thought I would give it a shot. There is a
thread
below with my exact question from the 20th but I can only see part of the
thread. I was hoping I could perhaps work around the rule without using
code. My field is called TherapyType. I want the control shaded in grey
if
these are the values.... "Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent". Is there some way to write an expression instead of using the 'If
Value is equal to' so I am not limited to just 3 conditions since Vent is
part of each therapy type?

Thanks,
Linda

Use:

Condition1
Expression Is
[TherapyType] In("Vent", "Vent NCPAP", "HFNC Vent", "Ossilator
Vent")


Alternatively....
If the [TherapyType] control is in the Report's detail section, for
example, code the Detail Format event:

If [TherapyType] = "Vent" or [TherapyType] = "Vent NCPAP" or
[TherapyType] = "HFNC Vent" or [TherapyType] = "Ossilator
Vent" Then
[TherapyType].BackColor = 12632256
Else
[Thera[yType].BackColor = vbWhite
End If

You could also use Select Case.
 

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